Hi ,All:
The
contents of following is the part of my edit page’s program.
There are no response if I use this program to modify some pages
content , but some pages are ok.
Could you please to help me to look at whether there is something
wrong? Thanks.
…..
$post
=
"title=$name&action=edit&basetimestamp=$ts&starttimestamp=$sts&token=$token&summary=$summary$extra&text=$newtext";
$response
= $this->postAPI($wiki, 'api.php', $post);
……
private
function postAPI($wiki, $url, $postdata = "") {
$wiki = $this->wiki($wiki);
$ch = curl_init();
$url = $wiki . $url;
if ($postdata !== "") {
$postdata .= "&";
}
$postdata .= "format=php&maxlag=" . $this->max_lag;
//echo $url.'?'.$postdata;exit;
//echo "Final postdata: $postdata<br />\n";
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:
application/x-www-form-urlencoded;charset=UTF-8'));
curl_setopt($ch, CURLOPT_HEADER, false);
$response = curl_exec($ch);
//print_r( unserialize($response));exit;
if (curl_errno($ch)) {
return curl_error($ch);
}
curl_close($ch);
return unserialize($response);
}