Warning: Invalid argument supplied for foreach() in /home/content/s/m/e/smetten/html/phpinfo.php5 on line 15 this is what´s on line 15: ($rss->channel->item as $item) Im experimenting with xml feeds. I can get other feeds to work, but this keeps giving me this error... Can anyone tell me what i must change <?php // Load and parse the XML document $rss = simplexml_load_file('http://api.indeed.com/apisearch?key=17a05830c4a0eb769feb73cfc499050d&q=&l=Wisconsin&sort=date&start=10&limit=100&fromage300=&filter=&latlong=1'); $title = $rss->channel->title; ?> <html xml:lang="en" lang="en"> <head> <title><?php echo $item; ?></title> </head> <body bgcolor=black link=yellow text=white> <h1><?php echo $item; ?></h1> <?php // Here we'll put a loop to include each item's title and description foreach ($rss->channel->item as $item) { echo "<h2><font color=red></font color> <a href='" . $item->url . "'>" . $item->jobtitle . "</a></h2>"; echo "<p> <font color=red></font color> " . $item->company . "</p>"; echo "<p> <font color=red></font color> " . $item->city . "</p>"; } ?> </body> </html> PHP:
check your rss source (copy the url into a browser and see the xml structure) I think what you're trying to do is: . . foreach ($rss->results->result as $item) { . . } PHP: