note 106969 added to function.file-get-contents

From: Date: Thu, 22 Dec 2011 07:30:10 +0000
Subject: note 106969 added to function.file-get-contents
Groups: php.notes 
Request: Send a blank email to php-notes+get-185199@lists.php.net to get a copy of this message
For those having this problem when trying to get_file_contents(url): Warning: file_get_contents(url): failed to open stream: HTTP request failed! in xx on line yy If you are behind a SonicWall firewall, read this: https://bugs.php.net/bug.php?id=40197 (this little line: uncheck a box in the internal settings of the firewall labled "Enforce Host Tag Search with for CFS") Apparently by default SonicWall blocks any HTTP request without a "Host:" header, which is the case in the PHP get_file_contents(url) implementation. This is why, if you try to get the same URL from the same machine with cURL our wget, it works. I hope this will be useful to someone, it took me hours to find out :) ---- Server IP: 69.147.83.197 Probable Submitter: 78.242.223.74 ---- Manual Page -- http://www.php.net/manual/en/function.file-get-contents.php Edit -- https://master.php.net/note/edit/106969 Del: integrated -- https://master.php.net/note/delete/106969/integrated Del: useless -- https://master.php.net/note/delete/106969/useless Del: bad code -- https://master.php.net/note/delete/106969/bad+code Del: spam -- https://master.php.net/note/delete/106969/spam Del: non-english -- https://master.php.net/note/delete/106969/non-english Del: in docs -- https://master.php.net/note/delete/106969/in+docs Del: other reasons-- https://master.php.net/note/delete/106969 Reject -- https://master.php.net/note/reject/106969 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#185199) next »