note 102248 deleted from function.curl-setopt by danbrown
| From: | danbrown@php.net | Date: | Thu, 03 Feb 2011 20:16:00 +0000 |
| Subject: | note 102248 deleted from function.curl-setopt by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-176663@lists.php.net to get a copy of this message | ||
Note Submitter: Stephan
----
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;
}
?>