本文整理汇总了PHP中nusoap_client::setCurlOption方法的典型用法代码示例。如果您正苦于以下问题:PHP nusoap_client::setCurlOption方法的具体用法?PHP nusoap_client::setCurlOption怎么用?PHP nusoap_client::setCurlOption使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nusoap_client
的用法示例。
在下文中一共展示了nusoap_client::setCurlOption方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setClientSoap
/**
* Permet de mettre en place le client de la requête en fonction du WSDL.
*
* @param $urlWsdl
* @return \nusoap_client
*/
private function setClientSoap($urlWsdl)
{
// Instanciation du client SOAP
$this->client = new \nusoap_client($urlWsdl, false, false, false, false, false, 0, 1000);
$this->client->soap_defencoding = 'UTF-8';
$this->client->decode_utf8 = false;
// Mise en place des options CURL
// Option curl
$this->client->setUseCurl(true);
// Mise en place du SSl si on l'active
if ($this->enabledSSL) {
// Mise en place des données d'authentification SSL
$certRequest = array('cainfofile' => $this->caChainClientLocation, 'sslcertfile' => $this->certClientLocation, 'sslkeyfile' => $this->privateKeyClientLocation, 'passphrase' => $this->privateKeyClientPassword);
$this->client->setCredentials('', '', 'certificate', $certRequest);
$this->client->setCurlOption(CURLOPT_SSLVERSION, 3);
// @TODO : cette option sera à mettre à true. On utilisera un fichier contenant l'AC Yousign en tant que trustore
$this->client->setCurlOption(CURLOPT_SSL_VERIFYPEER, false);
}
// @TODO : voir comment on lève une exception
$err = $this->client->getError();
if ($err) {
echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
echo '<h2>Debug</h2><pre>' . htmlspecialchars($this->client->getDebug(), ENT_QUOTES) . '</pre>';
exit;
}
return $this->client;
}
示例2: inicializarWebService
function inicializarWebService()
{
$proxy = array();
$proxy['server'] = !is_null($this->proxy) ? $this->proxy->server : false;
$proxy['port'] = !is_null($this->proxy) ? $this->proxy->port : false;
$proxy['username'] = !is_null($this->proxy) ? $this->proxy->username : false;
$proxy['password'] = !is_null($this->proxy) ? $this->proxy->password : false;
$client = new nusoap_client($this->configuracao->wsdl, false, $proxy['server'], $proxy['port'], $proxy['username'], $proxy['password'], 0, 3000);
$client->setDebugLevel(9);
$client->setUseCURL(true);
if (!is_null($this->certificado)) {
if (strlen($this->certificado->crt . $this->certificado->key . $this->certificado->pem) > 0) {
$client->setCurlOption(CURLOPT_SSL_VERIFYPEER, false);
$client->setCurlOption(CURLOPT_SSL_VERIFYHOST, 2);
$client->authtype = 'certificate';
if (strlen($this->certificado->crt) > 0) {
$client->certRequest['sslcertfile'] = $this->certificado->crt;
# file containing the user's certificate
}
if (strlen($this->certificado->key) > 0) {
$client->certRequest['sslkeyfile'] = $this->certificado->key;
# file containing the private key
}
if (strlen($this->certificado->pem) > 0) {
$client->certRequest['cainfofile'] = $this->certificado->pem;
# file containing the root certificate
}
}
}
$this->client = $client;
}
示例3: inicializarWebServiceSOF
function inicializarWebServiceSOF($configuracao)
{
$proxy = ConfigWs::factory()->getSiopProxyConfig();
$client = new nusoap_client($configuracao['wsdl_url'], false, $proxy['server'], $proxy['port'], $proxy['username'], $proxy['password'], 0, 3000);
$client->setDebugLevel(9);
$client->setUseCURL(true);
// Verifica se há algum dado de configuração para certificado.
// Caso houver define o tipo de autenticação para certificate.
$certificado = ConfigWs::factory()->getSiopCertificateConfig();
if (strlen($certificado['crt'] . $certificado['key'] . $certificado['pem']) > 0) {
$client->setCurlOption(CURLOPT_SSL_VERIFYPEER, false);
$client->setCurlOption(CURLOPT_SSL_VERIFYHOST, 2);
$client->authtype = 'certificate';
if (strlen($certificado['crt']) > 0) {
$client->certRequest['sslcertfile'] = $certificado['crt'];
# file containing the user's certificate
}
if (strlen($certificado['key']) > 0) {
$client->certRequest['sslkeyfile'] = $certificado['key'];
# file containing the private key
}
if (strlen($certificado['pem']) > 0) {
$client->certRequest['cainfofile'] = $certificado['pem'];
# file containing the root certificate
}
}
return $client;
}