求解决方案!
<?php
{
$ch = curl_init();curl_setopt($ch, CURLOPT_URL, $remote_server);curl_setopt($ch, CURLOPT_POSTFIELDS, 'mypost=' . $post_string);curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);curl_setopt($ch, CURLOPT_USERAGENT, "Jimmy's CURL Example beta");$data = curl_exec($ch);curl_close($ch);return $data;
}
?>
返回的结果是:{“state”:1,”msg”:”\u7528\u6237\u540d\u6216\u5bc6\u7801\u9519\u8bef\uff01″}
回复内容:
PHP模拟登录公司CRM系统并进行交互,登录界面采用Ajax验证并提交的,试过cURL没成功,页面链接:https://crm.pzoom.com
求解决方案!
<?php
function request_by_curl($remote_server, $post_string)
{
$ch = curl_init();curl_setopt($ch, CURLOPT_URL, $remote_server);curl_setopt($ch, CURLOPT_POSTFIELDS, 'mypost=' . $post_string);curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);curl_setopt($ch, CURLOPT_USERAGENT, "Jimmy's CURL Example beta");$data = curl_exec($ch);curl_close($ch);return $data;
}
echo (request_by_curl(“https://crm.pzoom.com/Index/checkform”,’userid=用户名&userpwd=密码’));
?>
返回的结果是:{“state”:1,”msg”:”\u7528\u6237\u540d\u6216\u5bc6\u7801\u9519\u8bef\uff01″}
curl post userid=用户名&userpwd=密码
到/Index/checkform
看看
你这个post请求的地址是https的,加上这个
curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,false);curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);
另外把你的'mypost=' .
去掉
一个ajax提交 成功了跳转到/Index/selectMedia 没验证码没什么token 没见过这么简单的东西了。。
ajax提交的吧
给你翻译了一下:
{"state":1,"msg":"用户名或密码错误!"}
到代码里去找原因吧