note 102503 added to class.soapclient
[email protected] Thu, 17 Feb 2011 21:17:31 -0800
| Newsgroups | php.notes |
|---|---|
| Message-ID | <[email protected]> |
When you need to connect to services requiring to send extra header use this method.
Here how we can to it with PHP and SoapClient
class ChannelAdvisorAuth
{
public $DeveloperKey;
public $Password;
public function __construct($key, $pass)
{
$this->DeveloperKey = $key;
$this->Password = $pass;
}
}
$devKey = "";
$password = "";
$accountId = "";
// Create the SoapClient instance
$url = "";
$client = new SoapClient($url, array("trace" => 1, "exception" => 0));
// Create the header
$auth = new ChannelAdvisorAuth($devKey, $password);
$header = new SoapHeader("http://api.channeladvisor.com/webservices/", "APICredentials", $auth, false);
// Call wsdl function
$result = $client->__soapCall("DeleteMarketplaceAd", array(
"DeleteMarketplaceAd" => array(
"accountID" => $accountId,
"marketplaceAdID" => "9938745" // The ads ID
)
), NULL, $header);
// Echo the result
echo "<pre>".print_r($result, true)."</pre>";
if($result->DeleteMarketplaceAdResult->Status == "Success")
{
echo "Item deleted!";
}
You can also see the this article in french at
http://zonereseau.progik.ca/fr/post/php-soapclient-service-wsdl-173
----
Server IP: 216.235.13.26
Probable Submitter: 173.179.68.187
----
Manual Page -- http://www.php.net/manual/en/class.soapclient.php
Edit -- https://master.php.net/note/edit/102503
Del: integrated -- https://master.php.net/note/delete/102503/integrated
Del: useless -- https://master.php.net/note/delete/102503/useless
Del: bad code -- https://master.php.net/note/delete/102503/bad+code
Del: spam -- https://master.php.net/note/delete/102503/spam
Del: non-english -- https://master.php.net/note/delete/102503/non-english
Del: in docs -- https://master.php.net/note/delete/102503/in+docs
Del: other reasons-- https://master.php.net/note/delete/102503
Reject -- https://master.php.net/note/reject/102503
Search -- https://master.php.net/manage/user-notes.php