| | |
simplexml_load_file() function error
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jan 2009
Posts: 123
Reputation:
Solved Threads: 2
Hi, all
I am using simplexml_load_file() function to get the rss and change it to the XML and get the elements.
But i got the error information like below:
My code is like this:
Where is the problem??
Many Thanks.
I am using simplexml_load_file() function to get the rss and change it to the XML and get the elements.
But i got the error information like below:
php Syntax (Toggle Plain Text)
failed to open stream: HTTP request failed! HTTP/1.0 503 Service Unavailable in
My code is like this:
php Syntax (Toggle Plain Text)
$zip = 10001; $url = "http://news.google.com/news?pz=1&ned=us&hl=en&q=".$zip."&output=rss"; $rss = simplexml_load_file($url);
Where is the problem??
Many Thanks.
•
•
Join Date: Aug 2007
Posts: 189
Reputation:
Solved Threads: 14
Use CURL or fsockopen() to get the result from Google, then simplexml_load_string()
php Syntax (Toggle Plain Text)
$zip = 10001; $url = "http://news.google.com/news?pz=1&ned=us&hl=en&q=".$zip."&output=rss"; $ch = curl_init(); $timeout = 5; // set to zero for no timeout curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $result = curl_exec($ch); curl_close($ch); $rss = simplexml_load_string($result);
![]() |
Similar Threads
- php reader of rss feeds (PHP)
Other Threads in the PHP Forum
- Previous Thread: Problem with PHP + GD - PNG Image Quality and Transparency problems
- Next Thread: mysql_real_esc_str expecting string
| Thread Tools | Search this Thread |
ajax apache api array beginner binary body broken buttons cakephp checkbox class cms code cron curl database date date/time display dynamic ebooks echo email error file files folder form forms function functions google href htaccess html image include insert ip javascript joomla limit link list login mail mediawiki menu mlm msqli_multi_query multiple mycodeisbad mysql number oop paypal pdf php phpincludeissue phpmyadmin problem query radio random recursion regex remote script search seo server sessions sms soap source sp space speed sql static subdomain syntax system table tag tutorial update upload url validator variable vbulletin video web webdesign white wordpress xml youtube





