Jump to content

How to implement a simple PHP webservice?


pstein

Recommended Posts

hw.php

<?php
echo "<?xml version=\"1.0\" ?> 
<title>Hello World</title>";
?>

 

On the remote site call:

<?php
$hw = simplexml("http://www.othersite.com/hw.php");
echo $hw->title;
?>

 

I am unsure if that works, but that is the basic gist of what I know of a webservice. simplexml is how you would read it out, and I do not know if I setup my XML right or echo'd the object property right. So yea. The above is a real rough example that is untested.

 

What's a PHP webservice?

 

WebService on Wikipedia

 

EDIT:

For a more (much more) advanced webservice look into soap.

 

The method I have shown, is not really a "webservice" per say. But for something simple, that would work. If you are looking for a real-world solution SOAP is definitely what you are going to need to use/look into.

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.