The small company i work for have asked me to MAYBE write a webservice in PHP. I have used webservices (Flickr, Youtube and so on). But never written one. I am an experienced PHP webdeveloper (obviously not webservices).
Before a accept/deny this task. Are there anything special with webservices or can i just do i like this:
if ($GET["something"]==="somethingelse")
{
header('Content-Type: application/json');
echo json_encode(array(Answer => 'yes'));
}
Can i do it like that?
Yes, you can, in fact this is a good start for your first webservice i think.
Having a php-script with diffrent branches (if-tests on url parameters) is very fast and easy way to create a webservice.
I would not use a SOAP/XML based webservice unless it was strictly required. (Saves time writing WSDL, testing etc). SOAP/XML webservices may give you features like UDDI (service catalogue), but again, I wouldn’t waste time make it if it was not required 🙂