Go Back   Free website templates > Web Template Help > PHP and MySQL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read


Join now to download all the free website templates or post on the forum. If you have never been on a forum before read the FAQ. It's quick, easy and free to join!
Closed Thread
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-04-2009, 12:49 PM
Junior Member
 
Join Date: Jun 2009
Posts: 25
gilbertsavier is on a distinguished road
Default PHP examples

Hello,
These are working for me, feel free to use them at your own risk

class MSSoapClient extends SoapClient {
private $namespace;
function __doRequest($request, $location, $action, $version) {


$request = preg_replace('/<ns1\w+)/', '<$1 xmlns="'.$this->namespace.'"', $request, 1);
$request = preg_replace('/<ns1\w+)/', '<$1', $request);
$request = str_replace(array('/ns1:', 'xmlns:ns1="'.$this->namespace.'"'), array('/', ''), $request);

// parent call
return parent::__doRequest($request, $location, $action, $version);
}
function setNamespace($sNamespace)
{
$this->namespace=$sNamespace;
}

}

To make a new customer - I'm only you can extend the function to add other details to the record.

function newKashflowCustomer($soapClient,$idAccount,$name,$ address,$town,$postcode,$country,$email)
{
//returns customer id if ok else 0

$today = date("Y-m-d",mktime());

$customerArray = array(
"CustomerID"=>"",
"Code"=>"",
"Name"=>"$name",
"Contact"=>"",
"Telephone"=>"",
"Mobile"=>"",
"Fax"=>"",
"Email"=>"$email",
"Address1"=>"$address",
"Address2"=>"",
"Address3"=>"$town",
"Address4"=>"$country",
"Postcode"=>"$postcode",
"Website"=>"",
"EC"=>"0",
"Notes"=>"",
"Source"=>"",
"Discount"=>"0",
"ShowDiscount"=>"0",
"PaymentTerms"=>"0",
"ExtraText1"=>"1",
"ExtraText2"=>"1",
"CheckBox1"=>"1",
"CheckBox2"=>"1",
"Created"=>"$today",
"Updated"=>"$today");

$args = array ("UserName"=>"your username here", "Password"=>"your password here","custr"=>$customerArray);
$oResponse = $soapClient->InsertCustomer($args);
//handle any errors
if($oResponse->Status != "OK")
{
echo $oResponse->StatusDetail;
$return = 0;

}
else
{
$id = $oResponse->InsertCustomerResult;

$return = $id;

}
return $return;
}


Thanks & regards
Lokananth
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 09:38 AM.



mouseover mouseover mouseover