Page 1 of 1

curl

Posted: Fri Aug 21, 2009 10:15 pm
by saltzmanjoelh
I am trying to get an image through a proxy with curl. When I add the proxy to curl options, it doesnt write to the file.

Code: Select all

 
    $ch = curl_init();
    $fp = fopen($local_path. $newfilename, "w");
    curl_setopt ($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_FILE, $fp);
    curl_setopt($ch, CURLOPT_HEADER, $header);
 
    curl_setopt($ch, CURLOPT_PROXY, $proxy);//remove this line and it works
 
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
    curl_setopt($ch, CURLOPT_REFERER, $referer);
    curl_setopt($ch, CURLOPT_USERAGENT, $agent);
    
    $result['EXE'] = curl_exec($ch);
    $result['INF'] = curl_getinfo($ch);
    $result['ERR'] = curl_error($ch);
    curl_close ($ch);
    
    fclose($fp);
    return $result;
 

Any ideas why?