Total members 11892 |It is currently Fri Oct 18, 2024 9:05 am Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





This is example for class inheritance in PHP .


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

        
$request preg_replace('/<ns1:(\w+)/''<$1 xmlns="'.$this->namespace.'"'$request1);
        
$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.
Code:
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;





Author:
Newbie
User avatar Posts: 23
Have thanks: 1 time

For this message the author gilbertsavier has received gratitude : codemiles
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : PHP example for a class
 Define class helper class to check the method existance     -  
 java abstract class,concrete class and interface     -  
 relationship between the Canvas class and the Graphics class     -  
 inner class that is a member of an outer class?     -  
 Define class inside another class C++     -  
 load class to applet- load frame class to applet     -  
 PHP class example     -  
 Circle class in C++     -  
 Vector class     -  
 Class Constants in php     -  



Topic Tags

PHP OOP
cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com