lundi 4 juillet 2016

Guzzle with telegram Bot API - 'GetMe' method not displaying a user object

I have the code

public function getClient(){
 $token = getenv('TELEGRAM_TOKEN');
 $uri = 'http://ift.tt/1LHu4Xl'.$token.'/';
 $client = new Client(['base_url' => $uri]);
 return $client;
}

public function getMyBot(){
 $client = $this->getClient();
 $response = $client->get( '/getMe' );
 dd($response);
}

But instead of returning the user object like stated in the docs, I get shown a 'response' object instead.

Response {#188 ▼
  -reasonPhrase: "OK"
  -statusCode: 200
  -effectiveUrl: "http://ift.tt/1J5UkKQ"
  -headers: array:9 [▼
    "server" => array:1 [▶]
    "date" => array:1 [▶]
    "content-type" => array:1 [▶]
    "content-length" => array:1 [▶]
    "connection" => array:1 [▶]
    "pragma" => array:1 [▶]
    "cache-control" => array:1 [▶]
    "x-frame-options" => array:1 [▶]
    "strict-transport-security" => array:1 [▶]
  ]
  -headerNames: array:9 [▼
    "server" => "Server"
    "date" => "Date"
    "content-type" => "Content-Type"
    "content-length" => "Content-Length"
    "connection" => "Connection"
    "pragma" => "Pragma"
    "cache-control" => "Cache-control"
    "x-frame-options" => "X-Frame-Options"
    "strict-transport-security" => "Strict-Transport-Security"
  ]
  -body: Stream {#189 ▼
    -stream: :stream {@280 ▶}
    -size: null
    -seekable: true
    -readable: true
    -writable: true
    -uri: "php://temp"
    -customMetadata: []
  }
  -protocolVersion: "1.1"
}

Anyway to obtain the user object? I am using php 5.4 with Guzzle 5.3, and laravel 5.0.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire