php web service return array


 what is web services in php ?

Nusoap is php classes library that is developed by free php script nusoap .A web services that is created with the help of nusoap php classes is called Nusoap web service.Nusoap lib is Free php-script which you can use for web service.you can learn creating web services using php.Creating web service in php  as easy as other code you write in php.Here you will learn how to creare web service in php.This is php web service example using nusoap lib.

web services using php.

  1.  Create new folder and rename it to "server" on your server space
  2. ( local user just create in htdocs. )
  3.  Download Nusoap library from 
  4. nusoap it is zip file
  5. You have to extract the "lib" folder from it and paste to web root(I.E htdocs).
  6.  Now create new php file in sever folder and rename it to "server.php"
  7. Paste the following code in it.
  8. server.php  
    error_reporting(0);
    
        //include required class for build nnusoap web service server
        require_once('../lib/nusoap.php');
    
        // Create server object
        $server = new soap_server();
    
              // configure WSDL
        $server->configureWSDL('PHP Web Services return array', 'urn:returnArray');
    
    
        // Complex Type Struct for return array
    $server->wsdl->addComplexType('array_php',
        'complexType',
        'struct',
        'all',
        '',
            array(
            'id' => array('id' => 'id', 'type' => 'xsd:string'),
            'firstname' => array('name' => 'firstname', 'type' => 'xsd:string'),
            'lastname' => array('name' => 'lastname', 'type' => 'xsd:string'),
            'email' => array('name' => 'email', 'type' => 'xsd:string')
           )
        );
    
        $server->wsdl->addComplexType('return_array_php',
        'complexType',
        'array',
        'all',
        'SOAP-ENC:Array',
        array(),
        array(
        array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:array_php[]')
        ),
        'tns:array_php'
        );
    
         
    
        $server->register('get_data',
        array('limit_start' => 'xsd:int','limit_end' => 'xsd:int'),
        array('return' => 'tns:return_array_php'),
        $ns,
        $ns.'#get_data',
        'rpc',
        'encoded',
        'Returns array data in php web service'
        );
    
        
    
        function get_data($limit_start,$limit_end) 
        {
          
           /* you can use mysql and your logic here
              this is sample array */
              
            $array_rtr=array();
            $array_rtr[0]['id']=0;
            $array_rtr[0]['firstname']='Nikunj';
            $array_rtr[0]['lastname']='Gandhi';
            $array_rtr[0]['email']='Nik_gandhi007@yahoo.com';
           
            $array_rtr[1]['id']=1;
            $array_rtr[1]['firstname']='ABC';
            $array_rtr[1]['lastname']='EGF';
            $array_rtr[1]['email']='ABC@yahoo.com';
           
            $array_rtr[2]['id']=2;
            $array_rtr[2]['firstname']='XYZ';
            $array_rtr[2]['lastname']='ZYX';
            $array_rtr[2]['email']='XYZ@yahoo.com';
            
            $array_rtr[3]['id']=3;
            $array_rtr[3]['firstname']='zcds';
            $array_rtr[3]['lastname']='asdsa';
            $array_rtr[3]['email']='dxds@yahoo.com';
            
            $array_rtr[4]['id']=4;
            $array_rtr[4]['firstname']='zxyctuzy';
            $array_rtr[4]['lastname']='zxkjch';
            $array_rtr[4]['email']='xyx@yahoo.com';
            
            $array_rtr[5]['id']=5;
            $array_rtr[5]['firstname']='sdd';
            $array_rtr[5]['lastname']='dss';
            $array_rtr[5]['email']='dss@yahoo.com';
     
            $array_rtr[6]['id']=6;
            $array_rtr[6]['firstname']='sa';
            $array_rtr[6]['lastname']='aZz';
            $array_rtr[6]['email']='axz@yahoo.com';
          
            $array_rtr[7]['id']=7;
            $array_rtr[7]['firstname']='xxz';
            $array_rtr[7]['lastname']='xcx';
            $array_rtr[7]['email']='zxz@yahoo.com';
            
            $array_rtr[8]['id']=8;
            $array_rtr[8]['firstname']='zxx';
            $array_rtr[8]['lastname']='eee';
            $array_rtr[8]['email']='eee@yahoo.com';
       
            $array_rtr[9]['id']=9;
            $array_rtr[9]['firstname']='xxxs';
            $array_rtr[9]['lastname']='ssa';
            $array_rtr[9]['email']='sssw@yahoo.com';
            
            $return=array();
            for($i=$limit_start;$i<=$limit_end;$i++){
               
               $return[$i]=$array_rtr[$i]; 
                
            }
                
            return $return;
    
        }
    
         
                        
        $server->service($HTTP_RAW_POST_DATA);
    
Now Client Side  Steps:
  
  1.  Now create new php file in sever folder and rename it to "client.php"
  2. Paste the following code in it.
  3. client.php  
    error_reporting(0);
      // includes nusoap class
    require_once('../lib/nusoap.php');
                  
    // Create object
    //change according your server settings
    $client = new nusoap_client('http://localhost:8081/web_service-return_array/server/server.php?wsdl', true);
    
    
    //use curl --set here to true
    //$client->use_curl=true;
    
    // Check for an error
    $err = $client->getError();
    if ($err) {
        // error if any
        echo '
    Constructor error
    
    ' . $err . '
    '; } $result = $client->call('get_data', array('limit_start' => 0,'limit_end'=>5),'','','',true); // fault if any if ($client->fault) { echo ' Fault
    ';
        print_r($result);
        echo '
    '; } else { // Check for errors $err = $client->getError(); if ($err) { // Display the error echo 'Error';
    ' . $err . '
    '; } else { // Display the result if($result!=false) { echo "Results"; foreach($result as $key=>$val) { //go through array print_r($val); } } } }

Buy Me a Beer-If you are like this post

 If you does not have paypal account create free account create account

4 best android gingerbread 2.3 phones 2011

Latest and best feature android 2.3 gingerbread phones 2011


1)Sony Ericsson Xperia Neo V
Size 116.0 × 57.0 × 13.0 mm / 4.6 × 2.2 × 0.5 inches
Weight 126.0 g / 4.4 oz
Screen 3.7" 16,777,216 colour TFT / 854x480 pixels
Platform Android 2.3 gingerbread
Camera 5MP
Memory Internal phone storage: 1GB (up to 320MB free)
RAM: 512MB
Memory card slot: microSD™, up to 32GB
More info about this phone Please visit
Sony Ericsson Xperia Neo V



2) Samsung Galaxy R


Size 125.70 x 66.70 x 9.55 mm
Weight 132g
Screen 3.7" 16,777,216 colour TFT / 854x480 pixels
Platform Android 2.3 gingerbread
Camera 5MP
Memory User Memory 8GB

SMS up to available memory

Phone Book Entries up to available memory

External Memory up to 32GB
More info about this phone Please visit


5-best-android-gingerbread-phones-2011-Samsung-galaxy-r5-best-android-gingerbread-phones2-2011-Samsung-galaxy-r

3)Sony Ericsson Xperia Mini  Pro


Size 92.0 × 53.0 × 18.0 mm / 3.6 × 2.1 × 0.7 inches
Weight 136.0 g / 4.8 oz
Screen 320 x 480 pixels (HVGA) / 16,777,216 color TFT
Platform Android 2.3 gingerbread
Camera 5MP
Memory Internal phone storage: 1GB (up to 320MB free)
RAM: 512MB
Memory card slot: microSD™, up to 32GB
More info about this phone Please visit


5-best-android-gingerbread2.3-phones-2011-sony-ericssion-mini-pro

5)Sony Ericsson Xperia Pro
Size 120.0 × 57.0 × 13.7 mm / 4.7 × 2.2 × 0.5 inches
Weight 142.0 g / 5.0 oz
Screen 3.7" 16,777,216 colour TFT / 854x480 pixels
Platform Android 2.3 gingerbread
Camera 8MP
Memory Internal phone storage: 1GB (up to 320MB free)
RAM: 512MB
Memory card slot: microSD™, up to 32GB
More info about this phone Please visit


5-best-android-gingerbread-phones-2011-Sony-Ericsson-Xperia-Pro

Buy Me a Beer-If you are like this post

 If you does not have paypal account create free account create account

android call details app 2011

Android App Reverse Call Lookup

Find out who's on the other end of unknown calls.


Easily perform a reverse lookup of any unknown number in your call history(or entered manually).
After caller info is found, user can save contact, dial number, block future calls, map location,and more.





Download Now 

Buy Me a Beer-If you are like this post

 If you does not have paypal account create free account create account

Best Go Launcher themes 2011


1)Go Launcher Xbox Live



Download Now Go Launcher theme

2)Iphone Go  Launcher Theme





Download Now Go launcher theme

3)Blue Highlight Theme





4)Iphone  Go Launcher





Download Now Go launcher theme

5)Pnk-gloss  Go Launcher





Download Go launcher android theme Now

6)Ocean Fantasy





Download Now Go Launcher Android theme


7)TouchWiz





Download Now Go Launcher theme

8)Coffie Theme







Download Now Go launcher theme now




Buy Me a Beer-If you are like this post

 If you does not have paypal account create free account create account