我正在尝试使用 Curl 更新 Aweber 中的一些自定义字段。当我尝试传递 postfields 时,aweber 告诉我我的会话已过期。但是,我可以登录并做其他员工而没有这个问题。
也许问题出在没有表单并且要验证的按钮不是输入类型提交而是一个按钮上有一些js功能?但是,我在 firebug 中查看“network”=> XHR,发送的链接与表单中的所有参数相同。
$str = 'data[submit]=1
&data[Lead][prev_stop_status]=0
&unsubscribe_lead=1
&data[Lead]['.$m.'][name]= name
&data[Lead]['.$m.'][email]='.$email.'
&data[Lead]['.$m.'][note]=control panel
&data[Lead]['.$m.'][datum1]=sdfg
&data[Lead]['.$m.'][datum2]=qsdfqsfd
&data[Lead]['.$m.'][datum3]=sdfgf
&data[Lead]['.$m.'][datum4]=zrtert
&data[Lead]['.$m.'][datum5]=dfgdf
&data[Lead]['.$m.'][name2]=sdfgsgf
&message_old=1
&data[Lead]['.$m.'][message]=1001
&sess_token='.$cookie'
这里 $m 对应lead的id。
$url ='https://www.aweber.com/users/leads/edit/3266822/'.$m;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_REFERER, 'https://www.aweber.com/users/leads');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookies_file);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$str);
echo curl_exec($ch);
希望足够清楚。我想发布一些来自 fireburg 的图片以帮助理解,但我需要更多的声誉点..
有人有想法吗?
编辑:这里是实时 http 标头的请求:
POST /users/leads/edit/3266822/59321794 data%5Bsubmit%5D=1&data%5BLead%5D%5Bprev_stop_status%5D=0&unsubscribe_lead=1&data%5BLead%5D%5B59321794%5D%5Bname%5D=blacky&data%5BLead%5D%5B59321794 %5D%5Bemail%5D=blackrunnnner%40gmail.com&data%5BLead%5D%5B59321794%5D%5Bnote%5D=+hf&data%5BLead%5D%5B59321794%5D%5Bdatum1%5D=stryrtyy&data%5BLead%5D%5B59321794%5D% 5Bdatum2%5D=tttttttttt&data%5BLead%5D%5B59321794%5D%5Bdatum3%5D=sdsdfsdfsdfs&data%5BLead%5D%5B59321794%5D%5Bdatum4%5D=dsfgdsfgd&data%5BLead%5D%5B59321794%Lezzzzzz&Bdatum%5D%5Bdatum%Lezzzzzz&Bdatum 5D%5B59321794%5D%5Bname2%5D=lmkmlkllllll&message_old=1&data%5BLead%5D%5B59321794%5D%5Bmessage%5D=1&sess_token=d18b8246230780a51e967326cf687009e9cc2d81
这里是标题:
https://www.aweber.com/users/leads/edit/3266822/59321794
发布 /users/leads/edit/3266822/59321794 HTTP/1.1
主持人:www.aweber.com
用户代理:Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0
接受:文本/html,/;q=0.01
接受语言:fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3
接受编码:gzip,放气
内容类型:application/x-www-form-urlencoded;字符集=UTF-8
X-Requested-With: XMLHttpRequest
推荐人:https ://www.aweber.com/users/leads
内容长度:619
饼干:cookie_aweber_referrer_id=99;TS8fba11=0db6c7090ec415a2a74f5b65b8aeffc52c7ef8b9018afb4c52e3ecfbbd1b0f791761e990;__utma=121506007.931755370.1390668636.1390668636.1390668636.1;__utmb=121506007.2.10.1390668636; __utmc=121506007; __utmz=121506007.1390668636.1.1.utmgclid=COD4yK_kmbwCFTCWtAod7U4ApA|utmccn=(not%20set)|utmcmd=(not%20set)|utmctr=aweber; _ga=GA1.2.931755370.1390668636; AppCookie[cookie_support]=支持;TS8fba11_29=c7dae97d9386c44fe3317a881058edd12c7ef8b9018afb4c00000000000000000052e3eb6c;__ctxpop=1; AUTORESPSID=d18b8246230780a51e967326cf687009e9cc2d81; AppCookie[客户]=1;AppCookie[curlis]=teststeli; kvcd=1390668716223; km_ai=Km0KWrpCZfFJ0Q7ArZebQRtwxVE%3D; km_uq=; km_vs=1;km_lv=1390668716; km_ni=836900;ki_u=9560e337-a9a3-16a1-44d0-1060ea2aa10c; ki_t=1390668681618%3B1390668681618%3B1390668681618%3B1%3B1
连接:保持活动
Pragma:无缓存
缓存控制:无缓存
data%5Bsubmit%5D=1&data%5BLead%5D%5Bprev_stop_status%5D=0&unsubscribe_lead=1&data%5BLead%5D%5B59321794%5D%5Bname%5D=blacky&data%5BLead%5D%5B59321794%5D%5Bemail%5D=blackrunnnner%40gmail。 com&data%5BLead%5D%5B59321794%5D%5Bnote%5D=+hf&data%5BLead%5D%5B59321794%5D%5Bdatum1%5D=stryrtyy&data%5BLead%5D%5B59321794%5D%5Bdatum2%5D=tttttttttt&数据9%5BLead%5D5271 %5D%5Bdatum3%5D=sdsdfsdfsdfs&data%5BLead%5D%5B59321794%5D%5Bdatum4%5D=dsfgdsfgd&data%5BLead%5D%5B59321794%5D%5Bdatum5%5D=zzzzzzzzzz&data%5BLead%5D%5B59321794%5D%5Bname2%5D=lmkmlkllllll&message_old =1&data%5BLead%5D%5B59321794%5D%5Bmessage%5D=1&sess_token=d18b8246230780a51e967326cf687009e9cc2d81
HTTP/1.1 200 正常
日期:2014 年 1 月 25 日星期六 17:08:56 GMT
p3p: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"
过期:1997 年 7 月 26 日星期一 05:00:00 GMT
最后修改时间:2014 年 1 月 25 日星期六 17:08:57 GMT
缓存控制:无存储、无缓存、必须重新验证、无缓存
Pragma:无缓存,无缓存
变化:接受编码,用户代理
内容编码:gzip
内容长度:164
保活:超时=3,最大值=100
连接:保持活动
内容类型:文本/纯文本
设置Cookie:TS8fba11=75ec74303092e39b0609f650ba7394ad2c7ef8b9018afb4c52e3efa8bd1b0f791761e990;路径=/