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
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 :)

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.