<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
    主站蜘蛛池模板: 亚洲国产成人无码AV在线| 亚洲日韩精品射精日| 亚洲三级中文字幕| 99在线免费观看视频| 亚洲国产成人久久综合一| 免费观看久久精彩视频| 国产精品亚洲片在线观看不卡| a高清免费毛片久久| 在线亚洲精品福利网址导航| 一本一道dvd在线观看免费视频 | 蜜桃成人无码区免费视频网站 | 亚洲av无码乱码在线观看野外 | 亚洲欧洲日韩国产综合在线二区| 免费不卡在线观看AV| 亚洲精品中文字幕无乱码| 一二三四免费观看在线电影 | 五级黄18以上免费看| 国产精品亚洲片在线观看不卡| 免费观看在线禁片| 亚洲第一页在线视频| 日本黄色免费观看| 午夜在线免费视频 | 国内精品99亚洲免费高清| 亚洲AV综合色一区二区三区| 精品无码AV无码免费专区| 亚洲日本久久久午夜精品| 亚洲 另类 无码 在线| 美女在线视频观看影院免费天天看| 91久久亚洲国产成人精品性色 | 五级黄18以上免费看| 亚洲精品无码不卡| 精品国产免费观看| 国产精品1024在线永久免费| 综合自拍亚洲综合图不卡区| 四虎影视免费在线| 国产做国产爱免费视频| 一本色道久久综合亚洲精品蜜桃冫| 四虎国产精品免费久久影院| 久久国产乱子免费精品| 性色av极品无码专区亚洲| 亚洲成A人片777777|