2009-06-01 6 views
0

PHP Wiki를 업데이트 할 때마다 미디어 위키 항목을 업데이트하기 위해 PHP 스크립트 작업을 해왔지만 기사 페이지는 편집되지 않았습니다.php와 curl을 사용하여 mediawiki를 업데이트합니다.

위키에 먼저 로그인하고 위키에서 정보를 읽었지만 업데이트하지 못했습니다.

내가 누락되었거나 더 나은 점이 있지만 mediawiki를 업데이트하는 데 사용할 수있는 기존 PHP 패키지가 있습니까? 사전에

덕분에,

샘플 코드는 다음과 같습니다

function curl_post_page($site, $post) { 
$headers = array(); 
$headers[] = 'Accept: image/gif, image/x-bitmap, image/jpeg, image/pjpeg'; 
$headers[] = 'Connection: Keep-Alive'; 
$headers[] = 'Content-type: application/x-www-form-urlencoded;charset=UTF-8'; 

//var_dump($post); 
$cl = curl_init($site); 
curl_setopt($process, CURLOPT_HTTPHEADER, $headers); 
curl_setopt($cl, CURLOPT_HEADER, true); 
curl_setopt($cl, CURLOPT_VERBOSE, true); 
curl_setopt($cl, CURLOPT_FAILONERROR, true); 
curl_setopt($cl, CURLOPT_POST, TRUE); 
curl_setopt($cl, CURLOPT_POSTFIELDS, $post); 
curl_setopt($cl, CURLOPT_CONNECTTIMEOUT, 30); 
curl_setopt($cl, CURLOPT_USERAGENT,"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT)"); 
curl_setopt($cl, CURLOPT_RETURNTRANSFER, true); 
curl_setopt($cl, CURLOPT_SSL_VERIFYPEER, false); 
curl_setopt($cl, CURLOPT_FOLLOWLOCATION, 1); 
curl_setopt($cl, CURLOPT_COOKIEFILE, "cookie.txt"); 

답변

0

가능 several client libraries이 있습니다 | API를 쓰기가 활성화 (known good revisionmirror at archive.org)

+1

이 링크가 질문에 대답 할 수 있지만 여기에 답변의 핵심 부분을 포함하고 참조 용 링크를 제공하는 것이 좋습니다. 링크 된 페이지가 변경되면 링크 전용 답변이 유효하지 않게 될 수 있습니다. – markus

+0

위키 피 디아 및 archive.org 아카이브 페이지 추가 - wikipedia 및 archive.org가 내 게시물보다 더 나은 아카이브/미러가 될 것으로 믿습니다. archive.org의 인터넷 아카이브는 10 년 이상이 자연의 거울을 제공 해왔다. –

0

가 있습니까? ($wgEnableWriteAPI = false;) 1.14 이하의 버전에서는 기본적으로 비활성화되어 있습니다.

errors이 다시 나타 납니까?