Last active
December 17, 2015 17:29
-
-
Save MasonM/5646755 to your computer and use it in GitHub Desktop.
This code creates a new account in Nutshell with an example address.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('USERNAME', '[email protected]'); | |
define('PASSWORD', '43c789d483fd76547b1f157e3cf5e580b95b9d8c'); | |
function findEndpoints($username) { | |
$soapClient = new SoapClient("http://api.nutshell.com/v1/soap?wsdl"); | |
return $soapClient->getApiForUsername($username); | |
} | |
$endpoints = findEndpoints(USERNAME); | |
$soapOptions = array( | |
'soap_version' => SOAP_1_2, | |
'user_agent' => 'Nutshell', | |
'login' => USERNAME, | |
'password' => PASSWORD, | |
'trace' => true, | |
); | |
$soapClient = new SoapClient("http://{$endpoints['api']}/api/v1/soap?wsdl", $soapOptions); | |
$result = $soapClient->newAccount(array( | |
'name' => 'this is a test', | |
'address' => array( | |
// One array for each address. | |
// This request just has one, but you can have an unlimited number of addresses on an account | |
array( | |
'address_1' => '100 Second St.', | |
'address_2' => 'Apt. 4', | |
'address_3' => 'c/o Barclay Fowler', | |
'city' => 'Ann Arbor', | |
'state' => 'MI', | |
'postalCode' => '48103', | |
'country' => 'US', | |
), | |
), | |
)); | |
var_dump($result); | |
echo $soapClient->__getLastRequest(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment