Php file_get_contents can not access some url while browser can

I’m trying to execute a url in php. Below are the urls that I run and the results

$feedback = file_get_contents('');
// echo $feedback
// null
$feedback = file_get_contents('');
// echo $feeback
// false
$feedback = file_get_contents('');
// I got error

//<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">

//<h4>A PHP Error was encountered</h4>

//<p>Severity: Warning</p>
//<p>Message:  file_get_contents( [<a href='function.file-get-contents'>function.file-//get-contents</a>]: failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error
//<p>Filename: controllers/register.php</p>
//<p>Line Number: 76</p>

My last url ‘’ however can run in the browser without error like that of using file_get_contents.
So what could be the problem here?

The command ‘file_get_contents’ does just that it reads the file like a page from a book,
a web browser by contrast interacts with the file… javascript runs, AJAX requests are made
& cookies are placed or read.

So your script has to ‘Talk’ to the target webpage, first sending information then listening for a reply.

Suggested reading…
CURL (command line data transfer toolpack library)
Cookies & CURL

The url doesnt return the correct headers for php file_get_contents() to interpret. This could be due to the fact that when i go to that url it says i should provide a compaign_id.

Missing parameter: _campaignID.

So in your browser you get to see that but because in reality the headers send from that url return the status code 500 file_get_contents will interpret that as “internal server error”. If you use chrome you can see this if you do ctrl+shift+i and go to the tab “network” then reload the page you will see “status” 500 internal server error. In firefox and opera you can also see this.