GyPSii API - PHP应用初探

GyPSii利用XML-RPC,PHP里XML-RPC的相关应用示例很多,查查手册、GOOGLE一下就可以找到很多。GyPSii API里提供了一个操作类用来请求服务,并提供了一个请求函数,只要将此函数放进操作类里,就可以方便的使用了,函数如下:

function GyPSiiXMLRPC( $uri, $host, $pid, $body="" ) {
    $this->addHeader( 'Content-Type', "application/x-gypsii-xmlrpc" );
    $this->addHeader( "X-GyPSii-Authorization", "GSAPI signer=\"$pid\",signature=\"$sig\",token=\"$tok\"" );
    $http->addHeader("Host","$host");
    $this->requestBody = $body;
    if( $this->sendCommand( "POST $uri HTTP/$this->protocolVersion" ) )
        $this->processReply();
    $this->removeHeader('Content-Type');
    $this->removeHeader('Content-Length');
    $this->removeHeader('X-GyPSii-Authorization');
    $this->requestBody = "";
    return $this->reply;
}
操作类下载地址:http://lwest.free.fr/doc/php/lib /index.php3?page=net_http_client&lang=en

你可能感兴趣的:(GyPSii API - PHP应用初探)