Total members 9936 | Gratitudes |It is currently Sun Feb 05, 2012 8:31 pm Login / Join Codemiles


All times are UTC [ DST ]




Post new topic Reply to topic  Quick reply  [ 1 post ] 
Author Article
 Article subject: PHP example for a class
PostPosted: Mon Aug 17, 2009 1:10 pm 
Offline
Newbie
User avatar

Joined: Fri Jun 26, 2009 5:50 am
Posts: 23
Has thanked: 0 time
Have thanks: 1 time

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;

_________________
Thanks & regards
Lokananth
[url "http://www.mioot.com"]Live Chat Software[/url] By miOOt



For this message the author gilbertsavier has received gratitude : codemiles
TOP
 Profile Send private message  
Reply with quote  
Post new topic Reply to topic Quick reply  [ 1 post ] 
Quick reply


  


 Similar topics
 Topic title   Forum   Author   Comments 
 Not to find nativeEncoder class jar  Java  Anonymous  0
 PHP class example  PHP examples  msi_333  0
 concrete class  Java  Anonymous  1
 Having a hard time with this class need help deseperately.  Java  Raven50  1
 Ladies & Gents Watches for 150-450 AED ,High Class.  Market  omarromaan  0

All times are UTC [ DST ]


Users browsing similar posts

Users browsing this forum: No registered users and 1 guest



Jump to:  
Previous Article | Next Article 




Home
General Talks
Finished Projects
Code Library
Games
Tutorials

Java
C/C++
C-sharp
php
Script
JSP/Servlets
Ajax
ASP/ASP.net
Google SEO
Database
Communications
Phpbb3 styles
Photoshop tutorials
Flash tutorials
Find a job






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team