Last Updated: February 25, 2016
·
1.06K
· brendanmurty

Basecamp API Query

Query the Basecamp API and return the result as an array

More information about the Basecamp API can be found at https://github.com/37signals/bcx-api/
Example: <? printr(bcresults('/people/me.json','99999999','dhjfksdhfjksdhfij32')); ?>

<?
function bc_results($api_url,$bc_account_id,$bc_user_token){
if($api_url){
    $api_url='https://basecamp.com/'.$bc_account_id.'/api/v1'.$api_url;
    $ch=curl_init();
    $options=array(
        CURLOPT_URL => $api_url,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HTTPHEADER => array('Content-type: application/json','Authorization: Bearer '.$bc_user_token),
        CURLOPT_USERAGENT => 'SampleAppName (test@testington.com)'
    );
    curl_setopt_array($ch,$options);
    return json_decode(curl_exec($ch),'true');
}
}
?>