Guest User

Untitled

a guest
Apr 25th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. include_once 'HTTP/OAuth/Consumer.php';
  2.  
  3. // get logged blip user
  4. public function getLoggedBlipUser() {
  5. $endpoint = self::$api_url . '/profile';
  6.  
  7. $json = $this->request($endpoint);
  8. if ($this->statius > 300) {
  9. return 'nieznany';
  10. } else return $json->login;
  11. }
  12.  
  13. private function request($endpoint) {
  14. try {
  15. $response = $this->consumer->sendRequest($endpoint, array(), $this->method);
  16. $reply = json_decode($response->getBody());
  17. $this->status = $response->getStatus();
  18. $this->phrase = $response->getReasonPhrase();
  19.  
  20. return $reply;
  21. } catch (HTTP_OAuth_Consumer_Exception_InvalidResponse $e) {
  22. echo $e->getBody();
  23. }
  24. }
Add Comment
Please, Sign In to add comment