2010年9月29日水曜日

php + xmlrpc => WordPress [en]

I tried to build application post to WordPress through XMLRPC-API using php and xmlrpc modules.
Almost works good, but i just have a little trouble when setting up categories to posted articles.
XMLRPC-API accepts categoryName instead of categoryID.

My site has auto post system to many SNSes and have arrays of IDs which category to post.
So, i have to use API named 'mt.getCategoryList' everu time posting any articles.
It's so silly process >o<.

Have a good day.

* Thanks.

2010年9月22日水曜日

convert SimpleXMLElement Object to standard class Object.

$stdObj = unserialize(str_replace('O:16:"SimpleXMLElement"', 'O:8:"stdClass"', serialize($xmlElement)));

シリアライズしたら何でもかんでも文字列表現になるので、ちょちょいと。

いろいろ試したけど、これが一番お手軽!