curl

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
saltzmanjoelh
Forum Newbie
Posts: 2
Joined: Fri Apr 03, 2009 4:50 pm

curl

Post 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?
Post Reply