php soap __dorequest,SoapClient->__doRequest() - PHP 5 中文文档

(no version information, might be only in CVS)

SoapClient->__doRequest()–

Performs a SOAP request

说明

class SoapClient

{

string __doRequest

( string request, string location, string action, int version )

}

Performs SOAP request over HTTP.

This method can be overridden in subclasses to implement different transport

layers, perform additional XML processing or other purpose.

参数

request

The XML SOAP request.

location

The URL to request.

action

The SOAP action.

action

The SOAP version.

返回值

The XML SOAP response.

例子 1. Some examples

<?phpfunction Add($x,$y) {return $x+$y;}class LocalSoapClient extends SoapClient {function __construct($wsdl, $options) {parent::__construct($wsdl, $options);$this->server = new SoapServer($wsdl, $options);$this->server->addFunction('Add');}function __doRequest($request, $location, $action, $version) {ob_start();$this->server->handle($request);$response = ob_get_contents();ob_end_clean();return $response;}}$x = new LocalSoapClient(NULL,array('location'=>'test://', 'uri'=>'http://testuri.org')); var_dump($x->Add(3,4));?>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
public function handle(array $arrParam = []) { $arrDeveloper = $this->getDeveloper($this->intAdvChannel); $strClientId = $arrDeveloper['client_id']; $strClientSecret = $arrDeveloper['client_secret']; $strCode = $arrParam['authorization_code'] ?? ''; $intAdvertiserRole = $arrParam['state'] ?? 2; $arrRequestData = [ 'client_id' => $strClientId, 'client_secret' => $strClientSecret, 'grant_type' => 'authorization_code', 'authorization_code' => $strCode, 'redirect_uri' => sprintf($this->getAuthCallbackUri(), Enum::GDT), //传入的地址需要与获取 authorization_code 时,传入的回调地址保持一致 ]; $arrOption = [ RequestOptions::QUERY => $arrRequestData, 'method' => 'GET', ]; $arrSelfResponse = Utils::doRequest($this->strAccessTokenUrl, $arrOption); if ($arrSelfResponse['code'] != 200) { return $this->errorArr($arrSelfResponse['code'], $arrSelfResponse['msg']); } $arrResponse = $arrSelfResponse['data'] ?? []; if (!isset($arrResponse['code']) || $arrResponse['code'] != 0) { Log::get($this->strChannelName)->error($this->strChannelName . "-获取access_token失败", [ 'url' => $this->strAccessTokenUrl, 'request' => $arrRequestData, 'response' => $arrResponse ]); return $this->errorArr(ErrorCode::OAUTH_GET_ACCESS_TOKEN_FAIL, $arrResponse['message']); } $arrAccessToken = $arrResponse['data']; $result = $this->setOAuthToken($arrAccessToken, $intAdvertiserRole, $arrParam['auth_request_id']); if ($result) { return $this->successArr(); } return $this->errorArr(); }在goframe框架中实现以上代码
05-28

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值