views:

389

answers:

1

UPDATE: SOLVED

Hi all, i've got it, just save cookie to temp file, and resubmit form with curl and set cookies with previous temp file :) thanks all for respond :)

Hi all,

i'm create some script to submit content via php curl. first fetch session and captcha, and user must submit captcha to final submit.

the problem is i can't get captcha, i've try with this code and preg_match to get image tag and return it

    $ch = curl_init();

 curl_setopt($ch, CURLOPT_URL,$url);  
 curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.2) Gecko/20070219 Firefox/2.0.0.2');
 curl_setopt($ch, CURLOPT_HEADER, 0);
 curl_setopt($ch, CURLOPT_COOKIE, 1);
 curl_setopt($ch, CURLOPT_COOKIEJAR, "1");
 curl_setopt($ch, CURLOPT_COOKIEFILE, "1");
 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);    
    $result = curl_exec($ch);  
    curl_close($ch);

But no luck, page i'm trying to submit is http://abadijayaiklan.co.cc/pasang-iklan/.

I hope someone can help me out :)

Thanks and regards

A: 

From the php manual page on curl_setopt, CURLOPT_COOKIEFILE and CURLOPT_COOKIEJAR should both specify a filename. You have them set to '1' (which may be valid, but is that what you intended?)

adam
Hi all, i've got it, just save cookie to temp file, and resubmit form with curl and set cookies with previous temp file :)thanks all for respond :)
Ferri Sutanto