开发者

XMLRPC Not working on Localhost

Hey guys, I've been working on a Wordpress theme for a while now and all works fine when it's on my server, but when I load it up on my machine loc开发者_StackOverflow社区ally I am unable to utilise certain functionality, namely the ability to post from outside the admin panel. To do this I use XMLRPC and the following code -

$params = array(0,$username,$password,$content,true);
$request = xmlrpc_encode_request('metaWeblog.newPost',$params);
$ch = curl_init();
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
curl_setopt($ch, CURLOPT_URL, $rpcurl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 1);
$results = curl_exec($ch);
        curl_close($ch);

The params passed are all valid and correct, and I just cannot figure out what is wrong for the life of me. Any help would be much appreciated.


Based on your fail point... sounds like your local machine isn't completely setup. Presumably PHP works if it gets to xmlrpc_encode_request before failing, but is php.ini setup correctly, and the XML-RPC library enabled?

Update: You need to remove the semi-colon from the line:

extension=php_xmlrpc.dll


Have you tried seeing what the response from the $results variable is? Is the $rpcurl variable set to the right URL?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜