private function getPageByPost($page, $data = null)
    {
        $url = $this->url . $page;
        // The new API allows JSON, so we can pass
        // PHP data structures instead of old school POST
        $json = json_encode($data);

        // cURL init & config
        $handle = curl_init();
        curl_setopt($handle, CURLOPT_URL, $url);
        curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($handle, CURLOPT_POST, 1);
        curl_setopt($handle, CURLOPT_USERAGENT, $this->userAgent);
        curl_setopt($handle, CURLOPT_VERBOSE, $this->verbose);
        curl_setopt($handle, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt($handle, CURLOPT_USERPWD, $this->authToken . ':x');
        curl_setopt($handle, CURLOPT_HTTPHEADER, array("Content-type: application/json"));
        curl_setopt($handle, CURLOPT_COOKIEFILE, $this->cookie);

        curl_setopt($handle, CURLOPT_POSTFIELDS, $json);
        $output = curl_exec($handle);

        curl_close($handle);

        // We tend to get one space with an otherwise blank response
        $output = trim($output);

        if (strlen($output)) {
            /* Responses are JSON. Decode it to a data structure */
            return json_decode($output);
        }

        // Simple 200 OK response (such as for joining a room)
        return true;
    }
private function getPageByPost($page, $data = null)
    {
        $url = $this->url . $page;
        // The new API allows JSON, so we can pass
        // PHP data structures instead of old school POST
        $json = json_encode($data);

        // cURL init & config
        $handle = curl_init();
        curl_setopt($handle, CURLOPT_URL, $url);
        curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($handle, CURLOPT_POST, 1);
        curl_setopt($handle, CURLOPT_USERAGENT, $this->userAgent);
        curl_setopt($handle, CURLOPT_VERBOSE, $this->verbose);
        curl_setopt($handle, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt($handle, CURLOPT_USERPWD, $this->authToken . ':x');
        curl_setopt($handle, CURLOPT_HTTPHEADER, array("Content-type: application/json"));
        curl_setopt($handle, CURLOPT_COOKIEFILE, $this->cookie);

        curl_setopt($handle, CURLOPT_POSTFIELDS, $json);
        $output = curl_exec($handle);

        curl_close($handle);

        // We tend to get one space with an otherwise blank response
        $output = trim($output);

        if (strlen($output)) {
            /* Responses are JSON. Decode it to a data structure */
            return json_decode($output);
        }

        // Simple 200 OK response (such as for joining a room)
        return true;
    }
private function getPageByPost ( $ page , $ data = null ) { $ url = $ this -> url . $ page ; // The new API allows JSON, so we can pass // PHP data structures instead of old school POST $ json = json_encode ( $ data ) ; // cURL init & config $ handle = curl_init ( ) ; curl_setopt ( $ handle , CURLOPT_URL , $ url ) ; curl_setopt ( $ handle , CURLOPT_RETURNTRANSFER , true ) ; curl_setopt ( $ handle , CURLOPT_POST , 1 ) ; curl_setopt ( $ handle , CURLOPT_USERAGENT , $ this -> userAgent ) ; curl_setopt ( $ handle , CURLOPT_VERBOSE , $ this -> verbose ) ; curl_setopt ( $ handle , CURLOPT_FOLLOWLOCATION , 1 ) ; curl_setopt ( $ handle , CURLOPT_USERPWD , $ this -> authToken . ':x' ) ; curl_setopt ( $ handle , CURLOPT_HTTPHEADER , array ( "Content-type: application/json" ) ) ; curl_setopt ( $ handle , CURLOPT_COOKIEFILE , $ this -> cookie ) ; curl_setopt ( $ handle , CURLOPT_POSTFIELDS , $ json ) ; $ output = curl_exec ( $ handle ) ; curl_close ( $ handle ) ; // We tend to get one space with an otherwise blank response $ output = trim ( $ output ) ; if ( strlen ( $ output ) ) { /* Responses are JSON. Decode it to a data structure */ return json_decode ( $ output ) ; } // Simple 200 OK response (such as for joining a room) return true ; }
Make a request to Campfire.
@param $page
@param null $data
@return bool|mixed
Make a request to Campfire .