我正在嘗試使用Curl來更新Aweber中的一些自定義字段。 當我嘗試通過postfields,aweber告訴我我的會話已過期。但是,我可以登錄並執行其他工作人員沒有這個問題。用CURL => session expired更新訂閱者
也許問題來自於沒有形式和驗證的按鈕不是輸入類型提交,而是一個有一些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對應於鉛的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 /用戶/引線/編輯/59321794分之3266822數據%5Bsubmit%5D = 1 &數據%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 &數據%5BLead%5D%5B59321794%5D%5Bdatum4%5D = dsfgdsfgd &數據%5BLead%5D%5B59321794%5D%5Bdatum5%5D = ZZZZZZZZZZ &數據%5BLead%5D%5B59321794%5D%5Bname2%5D = lmkmlkllllll & message_old = 1個&數據%5BLead%5D%5B59321794%5D%5Bmessage%5D = 1 & sess_token = d18b8246230780a51e967326cf687009e9cc2d81
和這裏的報頭:
https://www.aweber.com/users/leads/edit/3266822/59321794
POST /用戶/引線/編輯/ 3266822/59321794 HTTP/1.1
Host:www.aweber.com
User-Agent:Mozilla/5.0(Windows NT 6.1; WOW64; rv:25.0)Gecko/20100101 Firefox/25.0
Accept:text/html,/; q = 0.01
接受語言:fr,fr-fr; q = 0.8,en-us; q = 0.5,en; q = 0。3
接受編碼:gzip,放氣
內容類型:應用/ X WWW的窗體-urlencoded;字符集= UTF-8
X-請求-隨着:XMLHttpRequest的
的Referer:https://www.aweber.com/users/leads
的Content-Length: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 =(未%20set)| utmcmd =(未%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
連接:保持活着
附註:無緩存
緩存控制:無緩存
數據%5Bsubmit%5D = 1個&數據%5BLead%5D%5Bprev_stop_status%5D = 0 & unsubscribe_lead = 1 &數據%5BLead%5D%5B59321794%5D%5Bname%5D = blacky &數據%5BLead%5D%5B59321794%5D%5Bemail%5D = blackrunnnner% 40gmail.com & data%5BLead%5D%5B59321794%5D%5Bnote %5D = + HF &數據%5BLead%5D%5B59321794%5D%5Bdatum1%5D = stryrtyy &數據%5BLead%5D%5B59321794%5D%5Bdatum2%5D = tttttttttt &數據%5BLead%5D%5B59321794%5D%5Bdatum3% 5D = sdsdfsdfsdfs &數據%5BLead%5D%5B59321794%5D%5Bdatum4%5D = dsfgdsfgd &數據%5BLead%5D%5B59321794%5D%5Bdatum5%5D = ZZZZZZZZZZ &數據%5BLead%5D%5B59321794%5D%5Bname2%5D = lmkmlkllllll & message_old = 1 &數據%5BLead%5D%5B59321794%5D%5Bmessage%5D = 1 & sess_token = d18b8246230780a51e967326cf687009e9cc2d81
HTTP/1。1個200 OK
日期:星期六,2014年1月25日17時08分56秒GMT
P3P:CP = 「NOI ADM DEV PSAI COM NAV OUR OTRO STP IND DEM」
到期日:星期一,26 1997年七月05:00:00 GMT
的Last-Modified:星期六,2014年1月25日17時08分57秒GMT
的Cache-Control:無店鋪,無緩存,必重新驗證,無緩存
Pragma:no-cache,No-C疼痛
有所不同:接受編碼,用戶代理
內容編碼:gzip
的Content-Length:164
保持活動:超時= 3,最大= 100
連接:保持活動
的Content-Type:text/plain的
Set-Cookie:TS8fba11 = 75ec74303092e39b0609f650ba7394ad2c7ef8b9018afb4c52e3efa8bd1b0f791761e990; Path =/
你有重定向嗎?因爲在這種情況下,你可能還想指定一個cookiejar,而不是隻指定一個cookie文件。另外:在您發佈的示例中,您將爲數據添加換行符,如果將整個後置字符串設置爲一行,會發生什麼情況? – Wrikken
如何知道我是否得到重定向?我也試着指定一個cookiejar,但結果是一樣的。是的,我試圖在1行中完成所有。 –
暫時禁用關注位置並在輸出中包含標題,這會告訴你很多。然後再說一遍:你可能會問Awerber的人哪裏出了問題,或者看看你是否可以用他們的API來做你想做的。 – Wrikken