note 102248 added to function.curl-setopt
| From: | Stephan at osu1 dot php dot net | Date: | Thu, 03 Feb 2011 20:15:28 +0000 |
| Subject: | note 102248 added to function.curl-setopt | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-176662@lists.php.net to get a copy of this message | ||
A note to zsalab's curl_exec_follow():
Sometimes the Location: header does not contain the FQN, so the function fails.
To solve this call
_getActServer($newurl, $actserver);
before each
curl_setopt($rch, CURLOPT_URL, $newurl);
in his code and add one line to the beginning of the function
$actserver = "";
<?php
function _getActServer(&$newurl, &$actserver) {
preg_match('@^(?:http://)?([^/]+)@i', $newurl, $arr);
if ($arr[0])
$actserver = $arr[0];
if (!$arr[0])
$newurl = $actserver.$newurl;
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 79.228.215.130
----
Manual Page -- http://www.php.net/manual/en/function.curl-setopt.php
Edit -- https://master.php.net/note/edit/102248
Del: integrated -- https://master.php.net/note/delete/102248/integrated
Del: useless -- https://master.php.net/note/delete/102248/useless
Del: bad code -- https://master.php.net/note/delete/102248/bad+code
Del: spam -- https://master.php.net/note/delete/102248/spam
Del: non-english -- https://master.php.net/note/delete/102248/non-english
Del: in docs -- https://master.php.net/note/delete/102248/in+docs
Del: other reasons-- https://master.php.net/note/delete/102248
Reject -- https://master.php.net/note/reject/102248
Search -- https://master.php.net/manage/user-notes.php