Jump to content

Parse error: syntax error, unexpected $end in....


The450Man

Recommended Posts

I keep getting this error when trying to execute a script:

 

Parse error: syntax error, unexpected $end in mydomain.com/myfolder/script.php on line 35

 

Here is the script:

 

<?function wpPostXMLRPC($title,$body,$rpcurl,$username,$password,$category,$keywords='',$encoding='UTF-8') {
    $title = htmlentities($title,ENT_NOQUOTES,$encoding);
    $keywords = htmlentities($keywords,ENT_NOQUOTES,$encoding);

    $content = array(
        'title'=>$title,
        'description'=>$body,
        'mt_allow_comments'=>0,  // 1 to allow comments
        'mt_allow_pings'=>0,  // 1 to allow trackbacks
        'post_type'=>'post',
        'mt_keywords'=>$keywords,
        'categories'=>array($category)
    );
    $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);
    return $results;

$title="Lorem ipsum";
$body="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed vestibulum pharetra mi quis rhoncus. Mauris lacinia neque id lacus lobortis a dictum augue molestie. Proin ut elit velit, in faucibus neque. Aliquam libero odio, bibendum non tempor eu, sodales vel felis.";

$rpcurl="http://your_wordpress_blog_url/xmlrpc.php";
$username="Wordpress admin username here";
$password="Wordpress admin password here";
$categories="category name here";

echo wpPostXMLRPC($title,$body,$rpcurl,$username,$password,$categories,'');
?>

 

It posts to my wordpress blog via php.

 

I have been trying to solve it but have not had any luck.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.