(Objective-C) HTTP XMLRPC
Demonstrates an XML-RPC call to WordPress. WordPress ships with two test methods in its XML-RPC server, one of which is the "demo.sayHello" method. This example demonstrates sending the "demo.sayHello" XML-RPC request to Chilkat's cknotes.com Wordpress server. Note: This example requires Chilkat v11.0.0 or greater.
#import <CkoHttp.h>
#import <NSString.h>
#import <CkoHttpResponse.h>
BOOL success = NO;
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
CkoHttp *http = [[CkoHttp alloc] init];
NSString *xmlReq = @"<?xml version=\"1.0\"?><methodCall><methodName>demo.sayHello</methodName><params /></methodCall>";
CkoHttpResponse *resp = [[CkoHttpResponse alloc] init];
success = [http HttpStr: @"POST" url: @"http://www.cknotes.com/xmlrpc.php" bodyStr: xmlReq charset: @"utf-8" contentType: @"text/xml" response: resp];
if (success == NO) {
NSLog(@"%@",http.LastErrorText);
return;
}
NSLog(@"%@",resp.BodyStr);
|