curl ajax 区别,Curl: RE: Curl and Ajax

Date: Tue, 12 May 2009 15:48:13 +0000

Hello,

Thank you for quick reply.

Login script ;

$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 ;

$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

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

_______________________________________________

_________________________________________________________________

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值