note 52033 added to function.fsockopen

From: Date: Tue, 19 Apr 2005 15:40:50 +0000
Subject: note 52033 added to function.fsockopen
Groups: php.notes 
Request: Send a blank email to php-notes+get-88214@lists.php.net to get a copy of this message
If you are using fsockopen to access webpage, but come across a redirect (Location: ) in the header and want to find and follow the redirect as in this snippet: while (!feof($fp)) { $line=fgets($fp, 1024); if (stristr($line,"location:")!="") { $redirect=preg_replace("/location:/i","",$line); } } Then don't forget to trim($redirect) before trying to follow this new link as $redirect actually has a \r\n on the end of it and won't give you a valid path in the next iteration otherwise. A six hour bug. Saul Dobney ---- Manual Page -- http://www.php.net/manual/en/function.fsockopen.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+52033 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+52033&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+52033&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+52033&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+52033&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+52033&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+52033&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#88214) next »