这是表格:
<textarea name="message" id="messageContent" rows="18" wrap="virtual" tabindex="2"></textarea>
<span id="formSubmit">
<a href="#" class="formSubmit" tabindex="3">
<img src="/clear.gif" class="master-sprite sprite-pm-send">
</a>
</span>
formSubmit类是我在源代码上追踪的Ajax函数,我使用Fiddler来捕获我需要POST的params并发现:
callCount=1
c0-scriptName=PostFunctions
c0-methodName=insertPost
c0-id=1894_1310435282892
c0-param0=number:1578007
c0-param1=string:Hello%20World!
xml=true
Hello World!是我在textarea上写的并发布,fiddler也在标题上找到了一个cookie,不确定我是否需要使用它。有人可以帮忙吗?我现在试着将它发布2天,这真的让我发疯了!感谢
答案 0 :(得分:0)
请求页面并在http标头响应中拆分cookie 示例:
//get the cookies
$ch = curl_init("url");
$opts = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER => true
);
curl_setopt_array($ch, $opts);
$res = curl_exec($ch);
preg_match_all("/set-cookie:\s*([^\n]+)/i",$res,$cookies);
$cookies = implode(";", $cookies[1]);
//send the post with cookies in headers
$ch = curl_init("url");
$opts = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER => true,
CUOROPT_COOKIE => $cookies,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $params
);
curl_setopt_array($ch, $opts);
$res = curl_exec($ch);