web services - PHP: To implement API or WebService to transfer simple data? -


i'm bit confused api vs webservice. anyway, 1 follow to.. lets provide simple string or xml or json data return.

currently have implemented 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 standard way, how call/name it? shall name api? or webservice?
  • and in normal way (whenever need provide data out of server, above) 1 implement?


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -