Example #1
0
 /**
  *
  * @param Request $request
  * @return Response
  */
 public function executeProtobuf($request)
 {
     if (!$this->validate()) {
         throw new Exception("Missing authentication or Android ID");
     }
     $http = $this->executeRawHttpQuery($this->protobufToStr($request));
     $fp = fopen("php://memory", "w+b");
     fwrite($fp, $http, strlen($http));
     rewind($fp);
     $response = new Response();
     $response->read($fp);
     return $response;
 }
Example #2
0
 public function rawCommand($rawCommandData, $closesConnection = false)
 {
     $socket = $this->getSocket();
     $written = fwrite($socket, $rawCommandData);
     if ($written === false) {
         throw new ClientException('An error has occurred while writing a raw command on the network stream');
     }
     if ($closesConnection) {
         return;
     }
     return Response::read($socket);
 }