I'm a bit confused about API vs WebService
. But anyway, which one will you follow to.. lets say to provide simple string or xml or json data return.
Currently i have implemented something like:
Server:
echo json_encode("hello, ".$_POST["q"]);
Client:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $server_url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, array('q' => 'world!'));
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER , 1);
$response = curl_exec($ch);
curl_close($ch);
- Normally as the standard way, how do we even call/name it? Shall i name it
API
? OrWebService
? - And in normal way (whenever we need to provide some data out of Server, like above) which one do we implement?
webservice
andapi
– zerkms May 15 '13 at 2:10webservice
andapi
? – 夏期劇場 May 15 '13 at 2:10