NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming > CODE
Reload this Page Remote posting to WP via XML-RPC

CODE This forum is for posting code snippets and example scripts that aren't quite tutorials, but could be useful for others. You may post code snippets and/or completed scripts that you've written and want to share here.

Advanced Search
6 members in live chat ~  


Reply
 
LinkBack Thread Tools
Old 05-22-2011, 04:32 PM THREAD STARTER               #1 (permalink)
NamePros Regular
 
asgsoft's Avatar
Join Date: Sep 2005
Location: At Home
Posts: 881
asgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of light
 



Remote posting to WP via XML-RPC


Hey everyone

I am struggling to add tags and an Excerpt to my remotely published posts. The script is working fine, except it doesn't add these. Does anyone have any suggestions?

Here is my code so far:

PHP Code:
<?php
$user 
"root";
$pass "";
$host "localhost";
$dbname "dbname";
mysql_connect("$host""$user""$pass") or die(mysql_error()); 
mysql_select_db("$dbname") or die(mysql_error());
????: NamePros.com http://www.namepros.com/code/715845-remote-posting-wp-via-xml-rpc.html
$query "SELECT * FROM table where id='1'";
$result mysql_query($query) or die(mysql_error());

$rpcurl "http://localhost/wp/xmlrpc.php";

while(
$get mysql_fetch_array($result)){
$title $get['name'];
????: NamePros.com http://www.namepros.com/showthread.php?t=715845
$body $get['article'];
$excerpt $get['summary'];
$tags $get['keywords'];
$username "username";
$password "pass";
$categories "4";

$XML "<title>$title</title>".
"<category>$categories</category>".
"<mt_excerpt>$excerpt</mt_excerpt>".
"<mt_keywords>$tags</mt_keywords>".
$body;

$params = array('','',$username,$password,$XML,1);
$request xmlrpc_encode_request('blogger.newPost',$params);

$ch curl_init();
curl_setopt($chCURLOPT_POSTFIELDS$request);
curl_setopt($chCURLOPT_URL$rpcurl);
curl_setopt($chCURLOPT_RETURNTRANSFER1);
curl_setopt($chCURLOPT_TIMEOUT1);
curl_exec($ch);
curl_close($ch);
}
?>
Cheers
asgsoft is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Parsing XML for affiliate search dan_Vt Programming 0 01-12-2006 11:06 AM
PHP into XML? SquireQuack Programming 8 09-04-2005 06:03 AM
I need a XML feed done. Uneek Programming 0 10-28-2004 07:19 PM
flash & XML problem Cryptic Programming 0 04-18-2004 12:31 PM

 
All times are GMT -7. The time now is 07:43 PM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger