SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 301 | Next

Raymond Yee

"Pro Web 2.0 Mashups: Remixing Data and Web Services"

$resp->faultCode() . "\n" . 'Fault Reason: ' .
$resp->faultString() . "\n";
throw new Exception ($errormsg);
}
}
class flickr_client {
protected $api_key;
protected $server;
public function __construct($api_key, $debug) {
$this->api_key = $api_key;
$this->server =
new XML_RPC_Client('/services/xmlrpc','http://api.flickr.com',80);
$this->server->setDebug($debug);
}
public function call($method,$params) {
# add the api_key to $params
$params['api_key'] = $this->api_key;
# build the struct parameter needed
foreach ($params as $key=>$val) {
$xrv_array[$key] = new XML_RPC_Value($val,"string");
}
$xmlrpc_val = new XML_RPC_Value ($xrv_array,'struct');
$msg = new XML_RPC_Message($method, array($xmlrpc_val));
$resp = $this->server->send($msg);
return process_xmlrpc_resp($resp);
} //call
} //class flickr_client
CHAPTER 7 ?–  EXPLORING OTHER WEB APIS 175
function search_example () {
GLOBAL $API_KEY;
$server = new XML_RPC_Client('/services/xmlrpc','http://api.flickr.com',80);
$server->setDebug(0);
$myStruct = new XML_RPC_Value(array(
"api_key" => new XML_RPC_Value($API_KEY, "string"),
"tags" => new XML_RPC_Value('flower',"string"),
"per_page" => new XML_RPC_Value('2',"string"),
), "struct");
$msg = new XML_RPC_Message('flickr.photos.search', array($myStruct));
$resp = $server->send($msg);
return process_xmlrpc_resp($resp);
}
function gettime() {
# http://www.


Pages:
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313