PHP 8.3.7 Released!

SoapClient::__setLocation

(PHP 5 >= 5.0.4, PHP 7, PHP 8)

SoapClient::__setLocationDefine a localização do serviço Web a ser usado

Descrição

public SoapClient::__setLocation(?string $location = null): ?string

Define o URL do terminal que será acessado pelas solicitações SOAP seguintes. Isto é equivalente a especificar a opção location ao construir o SoapClient.

Nota:

Chamar esse método é opcional. O SoapClient usa o endpoint de arquivo WSDL por padrão.

Parâmetros

location

O novo URL do terminal.

Valor Retornado

O antigo URL do terminal.

Registro de Alterações

Versão Descrição
8.0.3 location agora é anulável.

Exemplos

Exemplo #1 Exemplo de SoapClient::__setLocation()

<?php
$client
= new SoapClient('http://example.com/webservice.php?wsdl');

$client->__setLocation('http://www.somethirdparty.com');

$old_location = $client->__setLocation(); // unsets the location option

echo $old_location;

?>

O exemplo acima produzirá algo semelhante a:

http://www.somethirdparty.com

Veja Também

add a note

User Contributed Notes 1 note

up
0
maoneid at gmail dot com
5 years ago
for some cases , ignoring location from initialization throw exception

PHP Fatal error: Uncaught SoapFault exception: [HTTP] Could not connect to host

Better call and define the end point location manually.
To Top