pstein Posted May 7, 2009 Share Posted May 7, 2009 Sorry for this newbie question. Could someone tell me on how to implement a simple php webservice? Need something like a "Hello world" for PHP webservice Quote Link to comment https://forums.phpfreaks.com/topic/157238-how-to-implement-a-simple-php-webservice/ Share on other sites More sharing options...
Ken2k7 Posted May 7, 2009 Share Posted May 7, 2009 What's a PHP webservice? Quote Link to comment https://forums.phpfreaks.com/topic/157238-how-to-implement-a-simple-php-webservice/#findComment-828519 Share on other sites More sharing options...
premiso Posted May 7, 2009 Share Posted May 7, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/157238-how-to-implement-a-simple-php-webservice/#findComment-828521 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.