PHP API Protection? -


i have simple php api. used curl client , $_post accept requests @ server side. ..

client:

<?php $ch = curl_init(); curl_setopt($ch, curlopt_url, "http://www.example.com/api-server"); 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);  echo json_decode($response); ?> 

server:

<?php echo json_encode("hello, ".$_post["q"]); ?> 

my questions here are:

  • am still following standard api logic anyway?
  • how "protect" api server access?

dont try & write api engine, these industry standard. @ soap or rest.

here of libraries out there heavy lifting:

then protect these use basic http protection, through oauth etc


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 -