runrunforest — 2012-01-30T04:53:18-05:00 — #1
I'm trying to execute a url in php. Below are the urls that I run and the results
$feedback = file_get_contents('http://google.com');
// echo $feedback
$feedback = file_get_contents('http://www.bigboommedia.com:8228/');
// echo $feeback
$feedback = file_get_contents('http://www.bigboommedia.com:8228/MG_Exchange.asmx/SendSMSv2?');
// 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>Message: file_get_contents(http://www.bigboommedia.com:8228/MG_Exchange.asmx/SendSMSv2) [<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>Line Number: 76</p>
My last url 'http://www.bigboommedia.com:8228/MG_Exchange.asmx/SendSMSv2' however can run in the browser without error like that of using file_get_contents.
So what could be the problem here?
sogo7 — 2012-01-30T06:28:04-05:00 — #2
The command 'file_get_contents' does just that it reads the file like a page from a book,
& cookies are placed or read.
So your script has to 'Talk' to the target webpage, first sending information then listening for a reply.
CURL (command line data transfer toolpack library) http://curl.haxx.se/
Cookies & CURL http://www.electrictoolbox.com/php-curl-cookies/
brense — 2012-02-01T05:38:55-05:00 — #3
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.