Coop and curl

Discussion in 'Co-op Advertising Network' started by moskita, Jan 9, 2005.

  1. #1
    Hello

    Can somebody help me to make Coop code to work with curl? :confused:
    (i can't use file_get_contens)

    here is my website:
    www.webfabryka.com/test.php
     
    moskita, Jan 9, 2005 IP
  2. eclipse

    eclipse Peon

    Messages:
    138
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Here You go:

    
    if (!function_exists('GetCurlPage')) {  
    function GetCurlPage ($pageSpec) {
       global $agent;
    
       if (!$agent) $agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
    
       $header[] = "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*";
       $header[] = "Connection: Keep-Alive";
    
       $ch = curl_init($pageSpec);
       curl_setopt($ch,    CURLOPT_RETURNTRANSFER, 1);
      
       curl_setopt($ch,    CURLOPT_USERAGENT, $agent);
       curl_setopt ($ch,    CURLOPT_HTTPHEADER, $header);
    
       curl_setopt($ch,    CURLOPT_REFERER, $refferer);
       
    
       curl_setopt($ch, CURLOPT_TIMEOUT, 120);
       curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60);
    
           $tmp = curl_exec ($ch);
           curl_close ($ch);
           unset($ch);
    
          return $tmp;
    }
    }
    
    PHP:
    Add this to coop ad network php file. Replace

    $new_ad = file_get_contents
    with
    $new_ad = GetCurlPage

    Works for me.
     
    eclipse, Jan 9, 2005 IP
  3. moskita

    moskita Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for Your help.
    Still don't working.
    (one ad served 5 times)

    and notices:
    Notice: Undefined offset: 3
    Notice: Undefined offset: 4
    Notice: Undefined offset: 1
     
    moskita, Jan 9, 2005 IP
  4. moskita

    moskita Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Problem seems to be solved!
     
    moskita, Jan 10, 2005 IP