0

Hello in the below PHP Code

Everything seems fine but it did not posts to the site when i use it

Can any one spot out what type of error it is

Also here the XML RPC is enabled and the when i access it directly it works(i mean the error message "XML-RPC server accepts POST requests only")

<?php


function wpPostXMLRPC($title,$body,$rpcurl,$username,$password,$categories=array(1))
{
    $username = "testuser";
    $password = "itestpaass";
    $rpurl = "http://domain.com/xmlrpc.php";
    $categories = "info";
    $XML = "<title>$title</title>"."<category>$categories</category>".$body;
    $params = array('','',$username,$password,$XML,1);
    $request = xmlrpc_encode_request('blogger.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);
    curl_exec($ch);
    curl_close($ch);



};

?>
2
Contributors
5
Replies
6
Views
7 Years
Discussion Span
Last Post by jhbalaji
0

Please remove the semi colon from line#23. as function defination dont need any delimiter (;) at the end

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.