Drupal - Services PHP XML-RPC Example

drupal.org.png

So I read all I could about Drupal Services, I looked in the docs, I searched the group, I found no good info on a external to drupal PHP XML-RPC Client that connects to Drupal Services and interface with the node. Actually I found that the process of auth, node.load, and node.save are very poorly documented. So I am posting my findings.

I will update this as I investigate the search and other services.

Greg

Directions:
In Drupal turn on "Use sessid" - admin/build/services/settings

In your XML-RPC Clinet you will use the following methods: 1-2-3a or 1-2-3b or 1-2-3c
1. system.connect with no args
returns - session id

2. user.login
requires - session id from system.connect

3a. node.load
requires - session id from user.login
requires - nid
requires - array of fields, or empty array

3b. node.save (new node)
requires - session id from user.login
requires - type
requires - uid & name - if you want to associate to a user, otherwise it will be anonymous
optional - any other field you want to specify

3c. node.save (update node)
requires - session id from user.login
requires - type
requires - uid & name - if you want to associate to a user, otherwise it will be anonymous
required - revision - time()
required - created - time()
required - nid
optional - any other field you want to specify

Links:
Docs - http://drupal.org/handbook/modules/services
Group - http://groups.drupal.org/services
PHP XML-RPC Lib - http://phpxmlrpc.sourceforge.net

Here is the sample code to connect, auth, node.load, node.save (new node), & node.save (update node)
Of course you should not run all of this at once.

<?php
include("xmlrpc.inc");
function print_nice($i){
        echo "<pre>";
        print_r($i);
        echo "</pre>";
}

//connect to the system
//get the session id to use for the user.login
$m = new xmlrpcmsg('system.connect',
                array()
                );
$c = new xmlrpc_client("?q=services/xmlrpc", "localhost", 80);
$c->setDebug(0);
$c->return_type = "phpvals";
$r = &$c->send($m);
if(!$r->faultCode()){
        $v=$r->value();
        $sessid = ($v['sessid']);
}else{
        print "An error occurred on system.connect: ";
}

//login to the system
//use the session id from the system.connect
//get logged in session id for node.load
$m = new xmlrpcmsg('user.login',
                array(
                        php_xmlrpc_encode($sessid),
                        php_xmlrpc_encode("user1"),
                        php_xmlrpc_encode("p4ssw0rd"),
                        )
                );
$c = new xmlrpc_client("?q=services/xmlrpc", "localhost", 80);
$c->setDebug(0);
$c->return_type = "phpvals";
$r = &$c->send($m);
if(!$r->faultCode()){
        $v=$r->value();
        $sessid = ($v['sessid']);
        $uid = $v['user']['uid'];
}else{
        print "An error occurred on user.login: ";
}

// get the info from a node
// use the session id from the user.login
// get node information
$m = new xmlrpcmsg('node.load',
                array(
                        php_xmlrpc_encode($sessid),                     //session from user.login
                        php_xmlrpc_encode(10),                          //nid
                        php_xmlrpc_encode(array()),                     //empty array for all option, array('title') if you want the title
                        )
                );
$c = new xmlrpc_client("?q=services/xmlrpc", "localhost", 80);
$c->setDebug(0);
$c->return_type = "phpvals";
$r = &$c->send($m);
if(!$r->faultCode()){
        $v = $r->value();
        print_nice($v);
}else{
        print "An error occurred on node.load: ";
}

//save new node
//use the session id from the user.login
//save new info to a node
$change = array(
                "type" => "page",                               //required
                "uid" => 1,                                     //required both uid and name to associate to a user
                "name" => "user1",                              //required both uid and name to associate to a user

                "title" => "TEST NODE.SAVE TITLE",
                "body" => "this is a body",
        );

$m = new xmlrpcmsg('node.save',
                array(
                        php_xmlrpc_encode($sessid),
                        php_xmlrpc_encode($change)
                        )
                );
$c = new xmlrpc_client("?q=services/xmlrpc", "localhost", 80);
$c->setDebug(0);
$c->return_type = "phpvals";
$r = &$c->send($m);
if(!$r->faultCode()){
        $v = $r->value();
        print_nice($v);
}else{
        print "An error occurred on node.save: ";
}

//update a node
//use the session id from the user.login
//send new info to a node
$change = array(
                "nid" => 14,                                    //required for update
                "revision" => time(),                   //required for update
                "changed" => time(),                    //required for update
                "type" => "page",                               //required
                "uid" => 1,                                     //required both uid and name to associate to a user
                "name" => "user1",                              //required both uid and name to associate to a user

                "title" => "TEST NODE.SAVE TITLE **UPDATES**",
                "status" => 1,                                  // = published
                "body" => "this is a body **UPDATES**",
        );

print_nice ($change);
$m = new xmlrpcmsg('node.save',
                array(
                        php_xmlrpc_encode($sessid),
                        php_xmlrpc_encode($change)
                        )
                );
$c = new xmlrpc_client("?q=services/xmlrpc", "localhost", 80);
$c->setDebug(0);
$c->return_type = "phpvals";
$r = &$c->send($m);
if(!$r->faultCode()){
        $v = $r->value();
        print_nice($v);
}else{
        print "An error occurred on node.save: ";
}
?>

Comments

zol

心療内科 看護師 募集 oaインストラクター 大阪 OAオペレーター 営業アシスタント 求人 福岡市 医療秘書 医局秘書 医局秘書 京都 医療秘書 医療秘書 アルバイト 医療秘書 就職 テレマーケティング バイト 特許事務所 求人 四日市 webデザイナー ウォーターサーバー 電気代 アクアジャパン Mizの樹 やずや ダイエット ウォーターサーバーとは クリティア ウォーターサーバー 費用 クリスタルクララ ウォーターサーバー デザイン オーケンウォーター ハワイアンウォーター 経理 バイト 北海道 動物看護師 求人 アデコ 貿易事務 貿易事務 大阪 貿易事務 紹介予定派遣 cadオペレーター 京都 cadオペレーター 求人 堺 cadオペレーター cadオペレーター 正社員 日払い データ入力 データ入力 仕事 dtpオペレーター 転職 求人 英文事務 英文事務 大阪市 アデコ 営業事務 不動産 営業事務 エステティシャン 転職 ヘルプデスク 名古屋 通訳 転職 静岡県 通訳案内士 愛知県 医療事務 医療事務 男性 医療事務 京都 医療事務 求人 愛知 医療事務 求人 関東 医療事務 求人 正社員 さいたま市 医療事務 求人 正社員 新卒 医療事務 求人 正社員 人事 募集 看護師 バイト 看護師 求人 愛知県 看護師 求人 福岡 看護師 求人 兵庫 看護師 求人 埼玉 アルバイト パソコンインストラクター 弁護士事務所 秘書 スポーツインストラクター バイト 転職 スポーツインストラクター テレマーケティング 新宿 翻訳 バイト webデザイナー 求人 未経験 webデザイナー 求人 webデザイナー 沖縄 静岡 webデザイナー webディレクター 正社員 つかってみんしゃい ひげ脱毛 ダンディハウス ひまわり証券 CFD SVC証券 CFD 経理 求人 経理 未経験 cadオペレーター バイト cadオペレーター 未経験 介護士 募集 データ入力 正社員 データ入力 短期 在宅アルバイト データ入力 dtpオペレーター 派遣 dtpオペレーター 就職 未経験 英文事務 ヘルプデスク 募集 通訳 求人 岩手県 通訳案内士 通訳案内士 京都 沖縄 通訳案内士 一般事務 求人 一般事務 大阪 調剤薬局 医療事務 求人 医療事務 アルバイト 医療事務 求人 広島 医療事務 求人 神奈川 医療事務 求人 北九州 医療事務 求人 未経験 医療事務 求人 名古屋 医療事務 求人 パート 静岡市 医療事務 求人

ths a lot ,but the node.load

ths a lot ,but the node.load method chanced node.get.

aaa

4 o'clocknokia 8800 yesterday afternoonNokia 8800 Sirocco, the reporterWatches with a small clear victory with Lee's uncle and went into the kindergarten, directorCheap Watches Zhao Guilan said:Cartier Watches "such asReplica watches dealing with the end cheap watchesof this matter, we immediatelyReplica Omega Watches expelled from the strict teacherIWC Watches." According to Zhao Replica Breitlingintroduced the directorChanel Watches, after the incidentfranck muller watches, She has a small replica watchesnursery on behalfGucci Replica of the parents clearly Cartier Watchapologizedreplica watches, kindergartens where such a thing happenedceramic replica watches, she is alsoswiss replica watches very angryreplica burberry watches, and parents are co-ordinationdata processing service to resolve. Zhao's directors to understand the situationdata processing, obviously hurt data processsmall "mini鸡鸡Ceramic tile" teacher of martial Micro sd cardslaw in the side. "I know that they are wrongWholesale clothing, I'm sorry!Wholesale jewelry" Yan saidugg boots, choking teachers and non-stop wholesale ugg bootsto the small victoryugg boots clearly apologize for the uncle Leeuggs. Strict 19-year-old teacher, came shortly after graduatingHigh pressure blower from kindergarten teachers to the kindergarten, only the work of more than a yearCommercial blower. It has been a teacher wholesaleof martial law, the class a total of more than 30 of their children, the afternoon the day of the incidentchina wholesale, she is teaching children with scissors to cut the ribbon of paperwholesale electronics, found that small children very wellmp4 watches and another to fightWholesale Mp4, so just before they wholesale beadscalled off the pants off of small obviously done playing behind two small handwholesale digital camera, with scissors into small after scare Road obvious: "wholesale camcordersdo not listen, do not cut your obedient 'small鸡鸡'." On the nightmp3 watch obviously hurt small "mp5 playersmall鸡鸡"and strict teacher, said while she took off hiswholesale pda mobile phones pants small obviously beat him when the pair met, while holding scissors is said to be in their own scare when a small touch of clearly. For teachers this is Yan, Li said the victory could not understand, he said: "how close the cutting blades will encounter 'small鸡鸡' roots, 4-year-oldpda mobile phones child to lie?" Interview, a small number of clearly meeting told reportersMichelle Obama's Shoes: "Teachers take scissorsluxurious cell phones I cut the 'small鸡鸡', also not allowed to crywholesale brand cell phones, cry a cut nosewholesale furniture." Yesterday afternoon, the two sides still did not reach a mediation agreementFurniture Wholesale. "Although the Paper did not just break the event, if the teacher was strict too hard, not the child's lifeblood, and now are scared to think." Lee told reporters the victory, if kindergarten is not to say that he would take up the law as a weapon for Children fight for fair play.

qqq

The authorityTiffany Bracelet of the Italian newspaper "Tiffany EarringsCorriere della SeraTiffany rings" reportedTiffany jewellers that the city of Bari Tiffany jewelryon suspicion of a company signed Tiffany jewellerya supply contract with the hospitalTiffany silver when there is corruptionghd in the companyGHD Dark by Claudio Giampaolo Tarantini ghd straightenersTarantini and brothers business ghd hair straighteners. Investigators ghd hair stylerfound that the recording of the dialogueCheap GHD, Claudio mentioned GHD pureto some GHD kissfriends of a young girlGHD MK4 Black attending the party to pay, and GHD MK4 Pinkthese friendsGHD MK4 Gold, including Silvio BerlusconiGHD Purple. Said Claudio coast in Sardinia don ed hardythere is a villa with Silvio Berlusconi's ed hardy shoesresidence close to where the two met over the yearsed hardy apparel. Claudio refused to commented hardy men on. His lawyer saided hardy women's: "We do not know the so-called 'ed hardy baglured into prostitutioned hardy tshirt' investigationugg boots, the judge also did not receive notice of the office from the investigationwholesale ugg boots." Bayesian actressugg sheepskin boots with the Spring tide? The newspaperchina wholesale also interviewed who had been invited to participate in such parties Patrizia television actresswholesale digital cameras, she comes from themp4 watches Italian city of Bari. PatriziaWholesale Mp4 said in October last yearwholesale t shirts, a man named Giampaolo peopleWholesale handbags who invited her to Silviowholesale clothing Berlusconi in Rome attending the party in the home, and she agreed to pay € 2000Wholesale jewelry. And the invited about 20 other beauties. Berlusconi played at the partywholesale, he and former U.S. President George WWholesale Jewelry. Bush met with the video and photographs of Sardinia villa, which is also for everyone to sing and tell jokes. Patrizia said he was Wholesale fashion jewelryPrime Minister at the party, see, she also spoke to the other side wants to build a hotel idea, but "because there is no where to spend the night," she ultimately received only € 1000. Soon after, she invited to Berlusconi's meeting, attended by women only she and Wholesale costume jewelrythe other two. This time, Silvio Berlusconi also promised their dreams, build the hotel and told her to stay overnight. Patrizia will meet these two have been recording.

sss

Ministry ghdof Information hair straightenersand Communication Ethicsghd uk Management Director Joe Kimghd straighteners told Xinhua that the network real-name system, or web authentication system ghd hair styleris based on the forthcoming ghd hair straightenersentry into force July ed hardy27 of "promoting the use of informationed hardy clothing and communication networks ed hardy capsand associated information protection ed hardy discountslaw" and the development of theed hardy online . Earliered hardy tshirts, South Korea has asked ed hardy womenthe Internet users in the registration Cheap GHDmail and chat room users who must use GHD puretheir real names and identity GHD kisscard numbers to verifyGHD MK4 Black. The real-name system involvingGHD MK4 Pink 35 sites The real-nameGHD MK4 Gold system, the implementation of the network site 35 is a daily average 300,000 GHD Purplepage views in the above portalTiffany Necklaces and daily page views in the media more than 200,000 websitesTiffany Ring. In order to facilitate the network Tiffany Bangleoperators and users to adapt to the new requirementsDiscount Tiffany, while protecting Tiffany 1837the network from the privacy of information, MinistryTiffany Atlas of Information and Communication to allowTiffany Watch Internet users through authenticationTiffany Paloma Picasso, the use of alternative, code-named their real names Tiffany Broochin the data available online. At the same time, the MinistryTiffany Cuff Linksof Information and Communications also plans to release on the Internet brochure to guide users to authenticate. Joe King said that according to "promote the use of information and communication Tiffany Key Ringnetworks and associated information protection law", the next South Korean Web site If you do not take the initiative to shielding of the obscene, the law and discredit the reputation of others suspected of network information such as articles and images will be on the bad information fromthose triggered by disputes negatively related to legal liability. In addition, the Ministry of Information and Communication Ethics Committee will also be information on the network management and supervision. At the same time, Ministry of Information and Communication Network also plans to set up the reputation of the Department of dispute resolution to deal specifically with violations Honorary network.

www.salepuma.com

re

禁煙 江原道化粧品お試しセット トリニティーライン ブロードイオン 通販 ウィ アピシア 三七石鹸 ナノアクア ナチュラルソープ オフィス家具 通販 リバイタラッシュ ベアミネラル:baremineral アンプルール アスタリフト 茶のしずく アムラエッセンス レディースプエラリア レディースプエラリア ムチャチャ グラグラ 二重まぶたにする(なる)方法 セルブライト セルブライト リバイタラッシュ フェブリナ(フェヴリナ)ジェルパック まつげエクステ「アイラッシュ」通販 アイホーン 悠香 茶のしずく 茶のしずく石鹸 吉野家 牛丼通販 即日発行 クレジットカード クレジットカード 即日発行 皇潤 皇潤 皇潤こうじゅん こうじゅん皇潤 ベトナム株の口座開設 酸素カプセル カルジェルナビ スパリゾート 加圧トレーニング オーベルジュ ダイエット食品 通販 外反母趾の予防と矯正ミニガイド H&M(へネス&モーリッツ)ミニガイド O脚の改善と矯正ミニガイド 電動自転車ミニガイド フーレセラピーミニガイド シロアリ対策ミニガイド 鈴虫寺 カルニチンクイーン カルニチンクイーン にんにく注射 質屋 大阪 質屋 東京 質屋 名古屋 借金相談 別れ方 湯たんぽ トモセラピー 歯並び 矯正 アートメイク 日焼けサロン 超音波エクステ TOEIC 勉強法 借金 無料相談 ベランダ ハト対策 黒鯛の釣り方 少年野球 ピッチング指導法 スノボー(スノーボード)の滑り方 薄毛対策・抜け毛対策 やずやの香酢 フーディア アルジルリン 化粧品お試しセット EGF化粧品パソアパソ アスタキュア 皇潤 ビーグレン(ビバリーグレン):b-glen 茶のしずく モンテセラピー ディセンシア(decencia) クリアジーノ ピュアハーバルヘアカラー エクスボーテ 女優肌 アスカ フツール 恋愛 メールテクニック 恋愛 メール 書き方

buy 4story Luna

Now do you worried about that in the game do not had enough 4story Luna to play the game, now you can not worried, my friend told me a website, in here you can buy a lot 4story Gold and only spend a little money, do not hesitate, it was really, in here we had much 4story money, we can sure that you will get the cheap 4story Luna, quick to come here to buy 4story Luna.

runescape gold

.Do you want to play WoW game?Welcome to our website for runescape gold and runescape powerleveling service.You can come and have a look!

wow gold

When the Wow Gold wolf finally found the Buy Wow Goldhole in the chimney he crawled wow gold cheap down and KERSPLASH right into that kettle of water and that was cheapest wow gold the end of his troubles with the big bad wolf. game4power,buy cheap wow gold WOW GOLD The next day the cheap wow gold buy gold wow little pig invited his mother over . She said "You see it is just as I told you. The way to wow goldget along in the world is to do world of warcraft gold things as well as you can." Fortunately for that little pig, he cheapest wow gold learned that lesson. And he just lived happily ever after!aion gold,buy aion gold.

silver jewelry

nice

yaling

shanshan

Week 15wow gold Players I LoveKyle Orton,wow gold QB,wow gold Bears: Two touchdownswow gold in each of wow goldhis past two wow goldgames, short weekswow gold favor the wow goldoffense and thewow gold Saints are 26th in the NFL in terms ofwow gold passing yards allowed. Orton might not be your first choice, but if you're stuck, I like him this week. By the way, wow goldfor those of you playing Pigskin Pick 'Em, he is 13-2 at home as a starter.

Is this D5 or D6?

Does it even matter? Thanks for sharing the code! Mike

cqx

In the Rainy wow goldSeason of Springwow power levelingIt drizelesworld of warcraft gold endlessly during wow goldthe rainy seasonwow power leveling in spring,Travellerswow gold along the roadwow gold look gloomy and miserable.

cuicui

There once wasreplica handbags a king who replica watchesoffered a prizeDesigner clothing to the artistDesigner replica handbags who would Wholesale jewelrypaint the bestReplica rolex watches picture of peace. replica handbagMany artists tried.hair straighteners The king GHDlooked at all chi hair straightenersthe pictures.replica handbags But there werewholesale handbags only two he replica designer handbagsreally liked, replica watchand he had swiss replica watchesto choose between replica rolex watchesthem. Onepuma shoes picture was of nike shoesa calm lake. womens clothesThe lake wased hardy clothing a perfect mirrorReplica Handbags for peaceful Replica Watchestowering mountainsreplica designer handbags all around it.Coach Handbags Overhead was a Gucci Handbagsblue sky with Rolex Watchesfluffy white clouds.Ladies Shop All who sawreplica prada handbagsthought that itwholesale omega watches was a perfectAdidas Shoes picture of peace. lacoste ClothesThe other picture ed hardy caps In the Rainyed hardy discounts Season of SpringIted hardy online drizeles endlesslyed hardy shirts during the rainy ed hardy womenseason in spring,Tiffany BraceletTravellers alongTiffany Earrings the roadTiffany jewellers look gloomy andTiffany jewelry miserable.When Tiffany ringsI ask a shepherd tiffany silverboy where I can find a tavern

replica fashion watches wholesale

There once wasreplica handbags a king who replica watchesoffered a prizeDesigner clothing to the artistDesigner replica handbags who would Wholesale jewelrypaint the bestReplica rolex watches picture of peace. replica handbagMany artists tried.hair straighteners The king GHDlooked at all chi hair straightenersthe pictures.replica handbags But there werewholesale handbags only two he replica designer handbagsreally liked, replica watchand he had swiss replica watchesto choose between replica rolex watchesthem. Onepuma shoes picture was of nike shoesa calm lake. womens clothesThe lake wased hardy clothing a perfect mirrorReplica Handbags for peaceful Replica Watchestowering mountainsreplica designer handbags all around it.Coach Handbags Overhead was a Gucci Handbagsblue sky with Rolex Watchesfluffy white clouds.Ladies Shop All who sawreplica prada handbagsthought that itwholesale omega watches was a perfectAdidas Shoes picture of peace. lacoste ClothesThe other picture ed hardy caps In the Rainyed hardy discounts Season of SpringIted hardy online drizeles endlesslyed hardy shirts during the rainy ed hardy womenseason in spring,Tiffany BraceletTravellers alongTiffany Earrings the roadTiffany jewellers look gloomy andTiffany jewelry miserable.When Tiffany ringsI ask a shepherd tiffany silverboy where I can find a tavern

wow gold

When the Wow Gold wolf finally found the Buy Wow Goldhole in the chimney he crawled wow gold cheap down and KERSPLASH right into that kettle of water and that was cheapest wow gold the end of his troubles with the big bad wolf. game4power,buy cheap wow gold WOW GOLD The next day the cheap wow gold buy gold wow little pig invited his mother over . She said "You see it is just as I told you. The way to wow goldget along in the world is to do world of warcraft gold things as well as you can." Fortunately for that little pig, he cheapest wow gold learned that lesson. And he just lived happily ever after!aion gold,buy aion gold. aion kina.

Deduper?

 for(;;) If i want to deduplicate and sort a list i think deduper.info is the bomb!