note 107830 added to function.file-get-contents
| From: | onglipo at hotmail dot com | Date: | Thu, 08 Mar 2012 05:27:50 +0000 |
| Subject: | note 107830 added to function.file-get-contents | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-186539@lists.php.net to get a copy of this message | ||
$header = file_get_contents('http://www.example.com/faq.jsp');
echo $header;
Fails with 500 Internal Server Error.
$opts = array('http'=>array('header' =>
"User-Agent:MyAgent/1.0\r\n"));
$context = stream_context_create($opts);
$header = file_get_contents('http://www.example.com/faq.jsp',false,$context);
//$header = file_get_contents('http://www.polama.com/faq.jsp');
echo $header;
Works!
----
Server IP: 69.147.83.197
Probable Submitter: 122.172.40.172
----
Manual Page -- http://www.php.net/manual/en/function.file-get-contents.php
Edit -- https://master.php.net/note/edit/107830
Del: integrated -- https://master.php.net/note/delete/107830/integrated
Del: useless -- https://master.php.net/note/delete/107830/useless
Del: bad code -- https://master.php.net/note/delete/107830/bad+code
Del: spam -- https://master.php.net/note/delete/107830/spam
Del: non-english -- https://master.php.net/note/delete/107830/non-english
Del: in docs -- https://master.php.net/note/delete/107830/in+docs
Del: other reasons-- https://master.php.net/note/delete/107830
Reject -- https://master.php.net/note/reject/107830
Search -- https://master.php.net/manage/user-notes.php