curl + php help

Discussion in 'PHP' started by zappak, Jan 9, 2013.

  1. #1
    hi.
    i'm trying to get page but cURL not able to add cookies coz of js.

    
    
    	$ch = curl_init();
    	$timeout = 500;
    	curl_setopt($ch,CURLOPT_URL,'http://playporn.to/');
    	curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
    	curl_setopt($ch,CURLOPT_USERAGENT,"Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.3) Gecko/20041001 Firefox/0.10.1" );
    	curl_setopt($ch,CURLOPT_REFERER,'http://www.google.com/search?hl=en&q=google&btnG=Google+Search');
    	curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
    	curl_setopt($ch,CURLOPT_COOKIEJAR,'temp.txt');
    	curl_setopt($ch,CURLOPT_COOKIEFILE,'temp.txt');
    	$data = curl_exec($ch);
            curl_close($ch);
    
    echo $data;
    
    PHP:
    anyone can help?
     
    zappak, Jan 9, 2013 IP
  2. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #2
    
    curl_setopt($ch,CURLOPT_HTTPHEADER, array("Cookie: sitechrx=f00cb81141aa364323e311ff83d876a2"));
    
    PHP:
    I imagine that changes with session/ip, just found out what the value is for wherever you are requesting it from ....
     
    krakjoe, Jan 9, 2013 IP
    zappak likes this.
  3. zappak

    zappak Active Member

    Messages:
    366
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    80
    #3
    thank you so much. . actually it's changing every hits sometime. but I got it working..

    thanks again..
     
    zappak, Jan 9, 2013 IP