我先看下相關(guān)代碼:
提交數(shù)據(jù) = “content=12345&uin=867400&replycampus=0&property=GoRE”
提交數(shù)據(jù)長(zhǎng)度 = 到文本 (取文本長(zhǎng)度 (提交數(shù)據(jù)))
內(nèi)容 = “POST /cgi-bin/new/msgb_addanswer.cgi HTTP/1.1” + #換行符
內(nèi)容 = 內(nèi)容 + “Accept: */*” + #換行符
內(nèi)容 = 內(nèi)容 + “Referer: http://m.qzone.qq.com/” + #換行符 ‘由哪個(gè)頁(yè)面來(lái)到這個(gè)頁(yè)面
內(nèi)容 = 內(nèi)容 + “Accept-Language: zh-cn” + #換行符
內(nèi)容 = 內(nèi)容 + “Content-Type: application/x-www-form-urlencoded” + #換行符
內(nèi)容 = 內(nèi)容 + “Accept-Encoding: gzip, deflate” + #換行符 ‘這里是gzip壓縮
內(nèi)容 = 內(nèi)容 + “User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; 20080914)” + #換行符
內(nèi)容 = 內(nèi)容 + “Host: m.qzone.qq.com” + #換行符
內(nèi)容 = 內(nèi)容 + “Content-Length: ” + 提交數(shù)據(jù)長(zhǎng)度 + #換行符 ' 這里告訴服務(wù)器我們POST數(shù)據(jù)是多少字節(jié)
內(nèi)容 = 內(nèi)容 + “Cache-Control: no-cache” + #換行符
內(nèi)容 = 內(nèi)容 + “Connection: Keep-Alive” + #換行符 ' 保持連接
內(nèi)容 = 內(nèi)容 + “Cookie: pt2gguin=o0000867400; ptcz=3e2483bfdb847715055cad88514a64bfc366de723f25d8d852e0b2611bb934de; pvid=4385960000; uin=o0000867400; skey=@FHM0ith66; randomSeed=7667652” + #換行符 + #換行符
內(nèi)容 = 內(nèi)容 + 提交數(shù)據(jù)
客戶(hù).連接 (“m.qzone.qq.com”, 80)
客戶(hù).發(fā)送數(shù)據(jù) (內(nèi)容)
這樣發(fā)送可以模擬不同版本的瀏覽器,紅色參數(shù)。
最后的兩個(gè)換行符不要忘記