Tag Archives: php online classes

How to install soap in php

Steps : How to install soap in php

Step 1 : Download soap library nusoap-for-php5 from the link :

Step 2 : unzip the nosoap in new folder “firstweb”.

Step 3 : Now Create two files server.php and client.php.

Step 4 : Inside the server.php Add the following code :

register('getUserData', array('value' => 'xsd:string'), array('return' => 'xsd:string'), 'urn:server', 'urn:server# getUserData');

function getUserData ()
	$items = array();
    $con = mysql_connect('localhost','root','');
	mysql_select_db('mydb', $con);
	$sql = "SELECT * FROM users";
	$query = mysql_query($sql);
	while($row = mysql_fetch_array($query)){

					$items [] = array(
		  return $items;

You can add more functions here as per the requirement for the database connection make a connection class and include it in header


$server ->service($HTTP_RAW_POST_DATA);


Now you have created the function on server.php file which will fetch data and return the response.

Step 5 : Add the following code in the client.php


                echo "Eroor: Code-".$client ->faultcode."";
                $result = $response;


Not Hit the client.php in url it will return the result.

Note: Client.php file is used for testing and development purpose.
All data which will be returned through the webservice will be in the form of the xml data set.