note 102248 deleted from function.curl-setopt by danbrown

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
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;
}
?>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.