Пример #1
0
 /**
  * Invia una risposta al client in base a un istanza di GraphResponse
  *
  * @param GraphResponse $response
  */
 private function sendResponse(GraphResponse $response)
 {
     $this->supportCors();
     http_response_code($response->getStatusCode());
     $h = $response->getHeaders();
     foreach ($h as $khdr => $hdr) {
         header($khdr . ': ' . $hdr);
     }
     //$this->supportCors();
     if ($response->getMedia() !== null) {
         // open the file in a binary mode
         $name = $response->getMedia();
         $fp = fopen($name, 'rb');
         fpassthru($fp);
     } else {
         print json_encode($response->getData(), JSON_PRETTY_PRINT);
     }
 }