Jump to content

Creating PHP Web Service


monkeynote

Recommended Posts

hello guys!

 

Im new to PHP world and i am trying to migrate my skillset into open source world. with my quest on open source programming, i've learned some basics in PHP like string and data manipulation.

 

i would like to create Web Service just like in asp.net. Where can i find some tools / tutorials to be used in order for me to learn how to create web service in PHP.

 

Thanks for reading my post guys! :)

 

 

Link to comment
https://forums.phpfreaks.com/topic/118411-creating-php-web-service/
Share on other sites

thanks for the reply guys!

 

i already have XAMPP configured on my pc and the webserver is up and running :)

 

i am planning to create a simple user log in that will pass "OK" if successful or "ER" if unsuccessful.

i would like to pass studentid to a webservice (PHP) that will return a recordset / array of schedules that will be queried by a remote application created in vb / vb.net / c#

 

here is a simple diagram.

 

Remote Desktop Application    <->  web service (PHP)  <->  MySQL Database

(vb / vb.net / c#)

 

i hope that you can guide me with my quest in learning how to create webservice in PHP :)

Thanks for the reply guys!  :)

 

Sorry about my last post. i am not aware that aside from SOAP, there are also XML-RPC and REST Web Services.

 

I would like to create a SOAP in PHP. I hope that i can create a web service in PHP and im excited to learn new in the open source world :)

hello guys!

 

i tried NuSOAP in EasyPHP running on thumbdrive

 

but my problem is i can't figure out this error message

 

<b>Notice</b>:  Undefined variable: HTTP_RAW_POST_DATA in <b>Z:\EasyPHP\NuSOAP\Server.php</b> on line <b>22</b><br />

 

i also change my PHP.ini file to enable HTTP_RAW_POST_DATA

; Always populate the $HTTP_RAW_POST_DATA variable.
always_populate_raw_post_data = On

 

i also restarted the apache server to reread my php.ini file but still i encounter the same error :(

 

i also double checked it by viewing <?php phpinfo(); ?> and it indicates that the always_populate_raw_post_data is ON.

 

here is the NuSOAP Sample Code

<?php
//call library
require_once ('lib/nusoap.php');

//using soap_server to create server object
$server = new soap_server;

//register a function that works on server
$server->register('hello');

// create the function
function hello($name)
{
  if(!$name){
    return new soap_fault('Client','','Put your name!');
  }
  $result = "Hello, ".$name;
  return $result;
}

// create HTTP listener

// i also tried this one but another error occurs
// err: <b>Notice</b>:  Undefined index:  content-type in <b>Z:\EasyPHP\NuSOAP\lib\nusoap.php</b> on line <b>4209</b><br />
// $HTTP_RAW_POST_DATA=isset($HTTP_RAW_POST_DATA)?$HTTP_RAW_POST_DATA:'';
// $HTTP_RAW_POST_DATA=isset($HTTP_RAW_POST_DATA)?$HTTP_RAW_POST_DATA:file_get_contents("php://input");

$server->service($HTTP_RAW_POST_DATA); // <-------- error in raw post data


exit();
?>

 

what is wrong with my configuration? is there any solution for this problem?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.