<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Sealyu

    --- 博客已遷移至: http://www.sealyu.com/blog

      BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
      618 隨筆 :: 87 文章 :: 225 評論 :: 0 Trackbacks

    Maybe not the most simple, but pretty close. This app posts a node to Drupal Services using XML-RPC. We thought it would be useful for anyone interested in building an iPhone app that interacts with Drupal and wanted a basic starting point. It provides two text fields and a submit button. Enter some text and press submit and the fields get posted to the Drupal site (the URL is hardcoded into the app, not very useful).

    On the Drupal end, you will need the Services, the XML-RPC server, and the Node Service modules enabled (these are all bundled with Services). In addition you will have to disable keys and sessid in Services (Site Building > Services > Settings). Also you have to allow anonymous access to services, and allow anonymous creation of story nodes (both in User management > Permissions). So you really do not want to do this on any kind of production site.

    The iPhone calls the node.save method by posting the following XML:

    <methodName>node.save</methodName>
    <params>
    <param><value><struct>
    <member><name>type</name><value><string>story</string></value></member>
    <member><name>title</name><value><string>title text</string></value></member>
    <member><name>body</name><value><string>body text</string></value></member>
    </struct></value></param>
    </params></methodCall>

    The iPhone app provides two ways to accomplish this. The first (commented out in the code) creates a HTTP POST request with the XML above as the body. This is not very useful since you have to provide the raw XML, but it shows how to execute an HTTP POST which is useful for many other things. The second uses XML-RPC functionality borrowed from the open-source wordpress app (which itself is a version of the Cocoa XML-RPC Framework ). This makes it much easier to formulate and execute XML-RPC calls, and the whole thing boils down to this:

        XMLRPCRequest *request = [[XMLRPCRequest alloc] initWithHost:[NSURL URLWithString: @"http://192.168.1.14/drupal-6.6/services/xmlrpc"]];
    NSMutableDictionary *postParams = [NSMutableDictionary dictionary];
    [postParams setObject:@"story" forKey:@"type"];    
    [postParams setObject:titleString forKey:@"title"];  // title input from iphone
    [postParams setObject:bodyString forKey:@"body"];    // body input from iphone
    [request setMethod:@"node.save" withObject:postParams];
    XMLRPCResponse *nodeSaveResponse = [XMLRPCConnection sendSynchronousXMLRPCRequest:request];

    The full app below. Developed with iPhone SDK 2.2.

    AttachmentSize
    simpleNodeTitleBody-XMLRPC.zip 899.47 KB
    posted on 2010-09-15 13:53 seal 閱讀(275) 評論(0)  編輯  收藏 所屬分類: PHPiPhone
    主站蜘蛛池模板: 亚洲欧洲免费无码| 一个人免费日韩不卡视频| 歪歪漫画在线观看官网免费阅读 | 亚洲欧美黑人猛交群| 国产成人精品免费视| 亚洲一区二区三区夜色| 亚洲免费在线播放| 亚洲人成影院在线| 91精品国产免费入口| 伊人久久综在合线亚洲2019| 免费毛片a线观看| 国产亚洲欧洲精品| 暖暖免费日本在线中文| 亚洲国产一区二区三区青草影视| 日日麻批免费40分钟无码| 久久精品a亚洲国产v高清不卡| 日本高清在线免费| 亚洲精品第一综合99久久| 国产精品成人免费综合| 日本中文字幕免费看| 国产亚洲精品美女久久久| 日本一卡精品视频免费| 亚洲乱码在线卡一卡二卡新区| 国产精品成人免费综合| 久草免费福利在线| 亚洲精品国产成人中文| 免费的一级片网站| 成av免费大片黄在线观看| 久久亚洲AV成人出白浆无码国产| 97人妻无码一区二区精品免费| 亚洲av午夜电影在线观看| 亚洲精品黄色视频在线观看免费资源| 你懂的免费在线观看| 亚洲伦理一二三四| 亚洲国产成人爱av在线播放| 男的把j放进女人下面视频免费| 亚洲香蕉久久一区二区三区四区| 免费国产小视频在线观看| 97在线免费观看视频| 久久亚洲最大成人网4438| 亚洲精品97久久中文字幕无码|