cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

RE: Curl and Ajax

From: Cem S <lordofthedreamer_at_live.com>
Date: Tue, 12 May 2009 15:48:13 +0000

Hello,

Thank you for quick reply.

Login script ;

<?php
  $cookie_file_path = "/home/xxxxx/public_html/cookie.txt";

        $fp = fopen($cookie_file_path,'wb');
        fclose($fp);

        $agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.12)Gecko/20050915 Firefox/1.0.7";

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL,"http://www.xxxxxx.com/user/login");
        curl_setopt($ch, CURLOPT_USERAGENT, $agent);
        curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
        curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
        curl_setopt($ch, CURLOPT_REFERER,"http://www.xxxxxx.com/user/login");
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt($ch, CURLOPT_HEADER, 1);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
        curl_setopt($ch, CURLOPT_POSTFIELDS,"name=admin&pass=adminhere&form_id=user_login&op=Log in");
        
        $store = curl_exec ($ch); //kaydet
        curl_setopt($ch, CURLOPT_COOKIEFILE, '/home/xxxxx/public_html/cookie.txt');
        curl_setopt($ch, CURLOPT_URL, "http://www.xxxxxx.com");
        $html = curl_exec($ch);
        echo $html;
?>

Post Script ;

<?php

$postdata=array();
// &form_id=drigg_node_form&op=Submit
$postdata['url']="http://www.domainname.com";
$postdata['title']="title";
$postdata['body']="body paragraph";
$postdata['taxonomy[4]']="32";
$postdata['taxonomy[tags][6]']="test";
$postdata['form_token']="87517a3d7c11c8d8af9f2d2f0142f1a1";
$postdata['form_id']="drigg_node_form";
$postdata['op']="Submit";

$agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.12)Gecko/20050915 Firefox/1.0.7";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://www.xxx.com/submit");
curl_setopt($ch, CURLOPT_COOKIEFILE, '/home/xxxx/public_html/cookie.txt');

curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$postdata);
$buf=curl_exec ($ch);
curl_close ($ch);

echo $buf;

?>

Post script fill the forms correctly and trying to submit it but the response from my web site is "Validation error, please try again. If this error persists, please contact the site administrator."

Sincerely,

Date: Tue, 12 May 2009 16:13:29 +0100
Subject: Re: Curl and Ajax
From: msjunior_at_gmail.com
To: curl-and-php_at_cool.haxx.se

as u said, posting ur script would help us help u

best.

2009/5/12 Cem S <lordofthedreamer_at_live.com>

Hello dear curl-and-php mail list users,

First time, I have joined a maillist, If I do something wrong, please let me know.

I have problem post something to my web site with curl. I am using drigg on my web site.

My script can/cannot do following actions ;

Can login to the web site.
Can fill the forms.
Can't submit.

I think, the problem is with drigg. Drigg checks urls valid or not.

Any help would be appreciated. If needed I could post my curl script.

Kind regards,

check out the rest of the Windows Live™.
More than mail–Windows Live™ goes way beyond your inbox.
 More than messages

_______________________________________________

http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php

_________________________________________________________________
More than messages–check out the rest of the Windows Live™.
http://www.microsoft.com/windows/windowslive/

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2009-05-12