box api - mapping automatically Box.com and Php -


i trying design application can create folder , retrieve folder box.com using php, have tried lots of apis fail.

also want create folder automatic authentication.

i have tried https://developers.box.com/docs/ can't automatic authentication.

    $ch = curl_init();     curl_setopt($ch, curlopt_url, "https://api.box.com/oauth2/token");     curl_setopt($ch, curlopt_header, false);      curl_setopt($ch, curlopt_encoding,"content-type:application/x-www-form-urlencoded");      curl_setopt($ch, curlopt_post, true);     curl_setopt($ch, curlopt_ssl_verifypeer, false);     curl_setopt($ch, curlopt_returntransfer,true);     curl_setopt($ch,    curlopt_customrequest,"post");     curl_setopt($ch, curlopt_httpheader, array("content-type: application/x-www-form-urlencoded", 'accept: application/json'));     curl_setopt($ch, curlopt_postfields,array('client_id=my_client_id&client_secret=my_client_secret_key&grant_type=urn:box:oauth2:grant-type:provision&username=my_email'));     $result = curl_exec($ch);     curl_close($ch);     print_r($result); 
  • here use client id, secret key , email id register in box.com

it gives kind of error:

{"error":"invalid_client","error_description":"the client credentials invalid"}

i recommend using boxphpapi. have used on big enterprise app. have make sure first have app created @ developers.box.com.

once done can pass info boxphpapi class , should handle login , authentication.

if plan on doing many api calls @ once or rapid succession recommended use curl pooling. speeds quite bit. 4 seconds under 1 (for 5+ api calls). can see example of pooling in fork of boxphpapi.

i hope helps!


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -