相信不少同学用过百度空间的文章post
现在遇到个问题,post之后一直返回 “数据添加的一般错误” 等错误页面
由于很少接触post ,使用的是论坛大大的UDF ,有对此有经验的给点指导吗
本人的大致代码如下:
#include <WinHttp_GetRespond.au3>
#include <array.au3>
#include <string.au3>
$MyOpen = _WinHttpOpen()
;登录参数
$loginact = "https://passport.baidu.com/?login"
$logincontent = "username=***&password=***&mem_pass=on"
;登录
$rContext = _WinHTTP_GetRespond($MyOpen, $loginact, 1 + 4 + 2, 50000, $logincontent, -1, "Content-Type: application/x-www-form-urlencoded")
;根据返回数据判断可以正常登录
;获取token数值
$rContext = _WinHTTP_GetRespond($MyOpen, "http://hi.baidu.com/*userid*/blog/modify/*articnum*", 2 + 4)
$token = _StringBetween($rContext[0], 'bdstoken value="', '"')
$token = $token[0]
;更新文章
$editact = "http://hi.baidu.com/*userid*/blog/submit/modifyblog"
$editcontent = 'bdstoken=' & $token & '&ct=1&mms_flag=0&cm=2&spBlogID=*blogid*&spBlogCatName_o=%C4%AC%C8%CF%B7%D6%C0%E0&edithid=&previewImg=&spBlogTitle=test&spBlogText=%3Cp%3Emyposttest%3C%2Fp%3E&spBlogCatName=%C4%AC%C8%CF%B7%D6%C0%E0&spBlogPower=0&spIsCmtAllow=0&spShareNotAllow=1&spIsCmtAllowObj=on&spShareNotAllowObj=on&spVcode=&spVerifyKey='
$rContext = _WinHTTP_GetRespond($MyOpen, $editact, 1 + 4 + 2, 50000, $editcontent, -1 ,"Content-Type:application/x-www-form-urlencoded")
|