954,585 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

failed to open stream: HTTP request failed! HTTP/1.1 503 Service Unavailable

Hi,
I am trying to read the content of url.
when manually i put url in browser

link : http://www.mvnforum.com/mvnforum/viewmember?member=pbmissions
it opens.

but using code

$homepage = file_get_contents('http://www.mvnforum.com/mvnforum/viewmember?member=pbmissions');
echo $homepage;


Warning: file_get_contents( http://www.mvnforum.com/mvnforum/viewmember?member=pbmissions ) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 503 Service Unavailable in C:\xampp\htdocs\test.php on line 2

What is problem ?
How to solve this?

Aamit
Posting Whiz
342 posts since Apr 2008
Reputation Points: 3
Solved Threads: 15
 

Your server admin must have turned off fopen'ing of URLs.

Use cURL ( www.php.net/curl )

nileshgr
Junior Poster
166 posts since Aug 2009
Reputation Points: 17
Solved Threads: 23
 

extension=php_curl.dll
it's on (i.e. already remove ;)

CAn you please tell me what to do?

Aamit
Posting Whiz
342 posts since Apr 2008
Reputation Points: 3
Solved Threads: 15
 

Post php.ini as attachment.

nileshgr
Junior Poster
166 posts since Aug 2009
Reputation Points: 17
Solved Threads: 23
 

Hi,
I posted php.ini as attachment.

To attach PHP.ini file it gives me error so i rename it to PHP-ini.php
and then upload.

Plz help me to solve this..

Attachments php-ini.php (45.22KB)
Aamit
Posting Whiz
342 posts since Apr 2008
Reputation Points: 3
Solved Threads: 15
 

Hi, I am trying to read the content of url. when manually i put url in browser

link : http://www.mvnforum.com/mvnforum/viewmember?member=pbmissions it opens.

but using code

$homepage = file_get_contents('http://www.mvnforum.com/mvnforum/viewmember?member=pbmissions');
echo $homepage;

Warning: file_get_contents( http://www.mvnforum.com/mvnforum/viewmember?member=pbmissions ) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 503 Service Unavailable in C:\xampp\htdocs\test.php on line 2

What is problem ? How to solve this?

There is nothing wrong with your code. It is just the response from the server:

HTTP/1.1 503 Service Unavailable


That means that the server is unavailable. Usually this is a temporary error.

NB: if the allow_url_fope n setting is preventing http requests you'd get a: "http wrapper disabled etc.." error

digital-ether
Nearly a Posting Virtuoso
Moderator
1,293 posts since Sep 2005
Reputation Points: 461
Solved Threads: 101
 

hi,

any other way to read the html of url??

Aamit
Posting Whiz
342 posts since Apr 2008
Reputation Points: 3
Solved Threads: 15
 

damn it. What happened to me that day when I was answering this thread lol.

Aamit, Your code is correct, but the server's down. You take any method to read HTML of URL be it file_get_contents or cURL, it can't help if the server is down.

nileshgr
Junior Poster
166 posts since Aug 2009
Reputation Points: 17
Solved Threads: 23
 

Thanks Man I have the same problem now I know what was wrong thanks a alot man.

Blitz-labs.com
Newbie Poster
12 posts since May 2010
Reputation Points: 10
Solved Threads: 0
 

Just pass user agent like this in your CURL param

$useragent="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1";

// set user agent
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);

jawaadkhan
Newbie Poster
1 post since Sep 2011
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You