// To use this code you should install CURL library first. class BontqApi { function init() { $this->ch = curl_init(); curl_setopt ($this->ch, CURLOPT_URL, "http://demo.bontq.com/service/api/signin/"); curl_setopt ($this->ch, CURLOPT_RETURNTRANSFER, true); curl_setopt ($this->ch, CURLOPT_POST, true); curl_setopt ($this->ch, CURLOPT_COOKIEJAR, "/tmp/cookie.txt"); $post = array( 'email'=>'demo@demo.bontq.com', 'pass' =>'demo'); curl_setopt ($this->ch, CURLOPT_POSTFIELDS, $post); curl_exec ($this->ch); // logged in curl_setopt ($this->ch, CURLOPT_URL, "http://demo.bontq.com/service/api/getitems/"); $post = array( 'orderdir' => 'desc', 'filter_items[0]' => 'task', 'filter_items[1]' => 'bug', 'filter_items[2]' => 'f_request', 'orderby' => 'date_opened', 'projectID'=> 1 ); curl_setopt ($this->ch, CURLOPT_POSTFIELDS, $post); $output = curl_exec ($this->ch);// xml with users $content_type = curl_getinfo( $this->ch, CURLINFO_CONTENT_TYPE ); header("Content-Type: {$content_type}"); echo $output; return true; } } //usage example $new = New BontqApi(); $new->init(); exit;