<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 閱讀(282) 評論(0)  編輯  收藏 所屬分類: PHPiPhone
    主站蜘蛛池模板: 国产黄色片免费看| 理论亚洲区美一区二区三区 | 国内精自视频品线六区免费| 亚洲午夜无码久久久久| 二个人看的www免费视频| 亚洲综合在线另类色区奇米| 无码的免费不卡毛片视频| 亚洲真人日本在线| 福利免费在线观看| 亚洲av永久无码精品国产精品| a级精品九九九大片免费看| 久久亚洲综合色一区二区三区| 国产精品偷伦视频观看免费 | 毛片a级毛片免费观看免下载| 亚洲娇小性xxxx| 国产zzjjzzjj视频全免费| 四虎影视久久久免费| 亚洲精品无码久久一线| 日韩精品无码免费一区二区三区 | 在免费jizzjizz在线播| 国产亚洲精品VA片在线播放| 在线观看免费国产视频| 国产福利电影一区二区三区,免费久久久久久久精 | 免费观看国产精品| 成在人线av无码免费高潮水| 久久精品国产亚洲综合色| 在线观看特色大片免费视频| 丰满亚洲大尺度无码无码专线| 中文字幕无码精品亚洲资源网| 免费视频成人片在线观看| 亚洲AV色欲色欲WWW| 亚洲一区二区女搞男| 日本成年免费网站| 美女免费视频一区二区| 亚洲嫩模在线观看| 日本黄色免费观看| 嫩草在线视频www免费观看 | 亚洲最大的黄色网| 亚洲国产精品第一区二区三区| 一区二区三区观看免费中文视频在线播放 | 青苹果乐园免费高清在线|