Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-14-2012, 09:00 AM   PM User | #1
anarchoi
New Coder

 
Join Date: May 2007
Posts: 65
Thanks: 4
Thanked 0 Times in 0 Posts
anarchoi is an unknown quantity at this point
simplexml help

Code:
$apiurl = "http://api.spreadshirt.com/api/v1/shops/266497/articles/10568005";
$feed = simplexml_load_file($apiurl);
$items = $feed->article;
foreach ($items as $article) {
$feeddesign = $article->product->defaultValues->defaultDesign[id];
echo $feeddesign;
}
why isn't it working

Last edited by anarchoi; 11-14-2012 at 10:15 AM..
anarchoi is offline   Reply With Quote
Old 11-14-2012, 10:01 AM   PM User | #2
Labrar
New Coder

 
Join Date: Jun 2008
Posts: 61
Thanks: 0
Thanked 12 Times in 12 Posts
Labrar is an unknown quantity at this point
article has no parent node.
Try this
PHP Code:
<?php
$apiurl 
"http://api.spreadshirt.com/api/v1/shops/266497/articles/10568005";
$feed simplexml_load_file($apiurl);
$items $feed;

foreach (
$items as $article =>$val) {

if(
strlen(trim($val))==0){
echo 
'<b><u>'.$article.'</u></b><br>';
echo 
'<pre>'print_r($items->$article); echo '</pre>';
}else{
echo 
'<b>'.$article.'</b> = '.$val.'<br>';
}
}
echo 
'<b>This is what you need</b> '.$items->product->defaultValues->defaultDesign[id];
?>

Last edited by Labrar; 11-14-2012 at 10:03 AM..
Labrar is offline   Reply With Quote
Old 11-14-2012, 10:15 AM   PM User | #3
anarchoi
New Coder

 
Join Date: May 2007
Posts: 65
Thanks: 4
Thanked 0 Times in 0 Posts
anarchoi is an unknown quantity at this point
Thanks a lot
anarchoi is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:45 AM.


Advertisement
Log in to turn off these ads.