| | |
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 |
301 ajax apache api array autosuggest beginner binary broken cakephp checkbox class cms code compression cron curl data database date display dynamic echo email error execution file files folder foreach form forms function functions google href htaccess html httppost image include insert integration ip java javascript joomla key library limit link links login mail md5 menu mlm multiple mysql mysql_real_escape_string oop paypal pdf php problem query radio random recursion regex remote script search searchbox server session sessions sms soap sorting source space sql syntax system table tutorial update upload url validator variable video volume votedown web website xml youtube zend





