/** * Set custom headers etc. required for connecting with the Happn api. * * @param null $url * @param string $method * @param array $data * @return object * @throws \Pecee\Http\Rest\RestException */ public function api($url = null, $method = self::METHOD_GET, array $data = array()) { $this->httpRequest->setOptions(array(CURLOPT_SSL_VERIFYHOST => false, CURLOPT_SSL_VERIFYPEER => false)); //$this->httpRequest->setPostJson(true); $this->httpRequest->setHeaders(array('Authorization: OAuth="' . $this->authToken . '"', 'Content-Type: application/x-www-form-urlencoded', 'User-Agent: Happn/19.1.0 AndroidSDK/19', 'Host: api.happn.fr', 'platform: android', 'connection: Keep-Alive')); return json_decode(parent::api($url, $method, $data)->getResponse()); }
/** * @param null $url * @param string $method * @param array $data * @return object * @throws \Pecee\Http\Rest\RestException */ public function api($url = null, $method = self::METHOD_GET, array $data = array()) { $this->httpRequest->setOptions(array(CURLOPT_SSL_VERIFYHOST => false, CURLOPT_SSL_VERIFYPEER => false)); $this->httpRequest->setPostJson(true); $this->httpRequest->setHeaders(array('X-Auth-Token: ' . $this->authToken, 'Content-type: application/json; charset=utf-8', 'app_version: 3', 'platform: ios', 'User-Agent: Tinder/2.2.2 (iPhone; iOS 7.0.2; Scale/2.00)', 'os_version: 700001')); return json_decode(parent::api($url, $method, $data)->getResponse()); }
public function api($url = null, $method = self::METHOD_GET, array $data = array()) { try { return parent::api($url, $method, $data); } catch (\Exception $e) { throw new ServiceException($e->getMessage(), $e->getCode()); } }
public function api($url = null, $method = self::METHOD_GET, array $data = array()) { $this->httpRequest->setOptions(array(CURLOPT_SSL_VERIFYHOST => false, CURLOPT_SSL_VERIFYPEER => false)); $this->httpRequest->setTimeout(10000); $data = array_merge($this->httpRequest->getPostData(), $data); // Add authentication required by index-search $this->httpRequest->setBasicAuth($this->username, $this->secret); // Execute the API-call return $this->onResponseReceived(parent::api($url, $method, $data)); }