
![]() |
imred
Hey guys,
So, I am embarking on writing my first content generator in .NET. I was hoping there might be someone who could give a bit of advice here not specifically related to.NET.The site will basically have: Homepage with several content sections which I will auto-generate (of course), but the main idea was adding a wordpress blog to the site to 'control' everything. I want to auto-update the blog with my own 'article spinner' and even add 'spun' pages to the blog as well... However, I would also like the blog to ping when those new posts go online. Is there a way to add those to Wordpress AND have them blog automatically? My content generator will basically take 'articles' that are in my own database, spin them, and post them to Wordpress. The rest of the generator will update the content on the homepage to include the links to Wordpress pages and then change the content around on occasion. I know this sounds a bit unthought out, but that really isn't the case. I mainly need to be able to auto-feed WP and then I am on my way. Thanks guys! nutballs
i actually am in the process of the same thing
use the XMLRPC to post. its the file at yourblog.com/xmlrpc. phpit will ping when you post. there are many discussions of xmlrpc out there, however, there do not seem to be many examples. my host doesnt have some of the XML functionality built in, so I had to go a non-standard route, but you could even just do it using perk's webrequest class. Since all you are sending is an specifically formed XML envelope to that xmlrpc. phppage.you can even assign posts to categories. I was going to insert straight into the wordpress database, but I decided to let the existing code in wordpress do all the heavy lifting. Why should I do it when it is already there? imred
Sounds interesting. I was considering writing directly to the database as well. It was either going to be email or database.
quote author=nutballs link=topic=624.msg4224#msg4224 date=1195097787 I was going to insert straight into the wordpress database, but I decided to let the existing code in wordpress do all the heavy lifting. Why should I do it when it is already there? Do you mean using the xmlrpc. php? Or are you talking about another method?I will certainly do some research now and I appreciate your help.! nutballs
yep its easy actually to do.
I had to use an alternative class to handle the code, since for some reason the default xmlrpc stuff that is built into phpdidnt work for me.so try the following code without the includes. If it doesnt work, go here: http://sourceforge .net/projects/phpxmlrpc/and download the code. You only need the 3 classes, and actually you might only need 2 of them but i havent gotten to my refinement phase. require_once('inc/xmlrpc.inc'); require_once('inc/xmlrpcs.inc'); require_once('inc/xmlrpc_wrappers.inc'); $c = new xmlrpc_client("/xmlrpc. php", "www.someblogofmine.com");$content['title']="Test Post"; $content['description']="This is a <!--more-->a test post"; $content['categories'] = array("somecategory"); $content['mt_keywords'] = array("this is a tag","and another tag"); $x = new xmlrpcmsg("metaWeblog.newPost", array( php_xmlrpc_encode("1"![]() php_xmlrpc_encode("admin"![]() php_xmlrpc_encode("yourpassword"![]() php_xmlrpc_encode($content),php_xmlrpc_encode("1"![]() $c->return_type = ' phpvals';$r =$c->send($x); perkiset
Nicely done NBs... ooooh man the gears are spinning...
imred
quote author=perkiset link=topic=624.msg4229#msg4229 date=1195108323 Nicely done NBs... ooooh man the gears are spinning... Mine just spun off their track ![]() nutballs
its actually not really anything new, since thats how most of the off the shelf content generators work, including the autoposters for wordpress.
HOWEVER. if you can xmlrpc your own stuff, you can post to ANY xmlrpc capable blog that you have permissions for. so wordpress, typepad, moveabletype,blogger, etc etc etc etc. But the biggest reason for me is to be able to completely separate the content generation from the delivery. Generate here - deliver anywhere. imred
So, I got to work...
![]() For those .NETguys out there: This is basic code that will allow you to post to your WORDPRESS blog. It is VERY rudimentary, but should get any idiot (like myself) started.FIRST: Download XML-RPC .Net(http://www.xml-rpc.net/)SECOND: Add the reference to the dll (CookComputing.XmlRpcV2.dll) to your VB .NetprojectTHIRD: Add a simple form to your project (for the pushbutton to run the post) FOURTH: Use the code below to write to your blog!!!! Imports CookComputing.XmlRpc Public Class Form1 Public RetError As Integer <XmlRpcUrl("http://YourBlogURLGoesHere/xmlrpc. php"![]() Public Interface IWP Inherits IXmlRpcProxy <XmlRpcMethod("blogger.newPost" ![]() Function newPost(ByVal args() As String) As Integer End Interface Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim proxy As IWP = XmlRpcProxyGen.Create(Of IWP)() Dim args() As String = {"", "", "YourUserName", "YourPassWord", "Your Content Goes Here", "publish"} RetError = proxy.newPost(args) End Sub End Class If you can't figure it out from that.... you might want to stop coding ![]() |

Thread Categories

![]() |
![]() |
Best of The Cache Home |
![]() |
![]() |
Search The Cache |
- Ajax
- Apache & mod_rewrite
- BlackHat SEO & Web Stuff
- C/++/#, Pascal etc.
- Database Stuff
- General & Non-Technical Discussion
- General programming, learning to code
- Javascript Discussions & Code
- Linux Related
- Mac, iPhone & OS-X Stuff
- Miscellaneous
- MS Windows Related
- PERL & Python Related
- PHP: Questions & Discussion
- PHP: Techniques, Classes & Examples
- Regular Expressions
- Uncategorized Threads