HTTPRequest::send PHP Method

send() private method

private send ( $raw )
    private function send($raw)
    {
        call_user_func($this->send_cb, $this->sock, $raw);
    }

Usage Example

コード例 #1
0
 public function retrieve_user_details()
 {
     // Get the stream to the user page via the Snipt API
     $request = new HTTPRequest(SNIPT_API . SNIPT_USER . SNIPT_FORMAT, HTTP_METH_GET);
     echo "Connecting to Snipt API....\n";
     $request->send();
     if ($request->getResponseCode() == 200) {
         $this->user_details = json_decode($request->getResponseBody());
         echo "Snipt entries to retrieve : {$this->user_details->count}\n";
         foreach ($this->user_details->snipts as $snipt) {
             // Retrieve the snipt entry
             $request = new HTTPRequest(SNIPT_API . SNIPT_SNIPT . $snipt . "." . SNIPT_FORMAT . SNIPT_STYLE);
             $request->send();
             if ($request->getResponseCode() == 200) {
                 $this->snipts[$snipt] = json_decode($request->getResponseBody());
             } else {
                 echo "[ERROR] Could not retrieve the data for snipt entry {$snipt}\n";
             }
         }
         return true;
     } else {
         echo "Invalid data received, exiting....\n";
         return false;
     }
 }
All Usage Examples Of HTTPRequest::send