title: Guzzle 6 - getting the effective url
body: <p>I have just upgraded from guzzle 3 to guzzle 6</p>
  
  <p>Now i have some code here..</p>
  
  <pre><code>$request = $this-&gt;_client-&gt;get($url);
             $response = $request-&gt;send();
             $url = $response-&gt;getInfo('url');
  
             return $url;
  </code></pre>
  
  <p>After updating to guzzle 6 I see that getInfo() &amp; also geteffectiveurl() has been removed.. for some reason. so my new code is...</p>
  
  <pre><code>$res = $this-&gt;_client-&gt;request('GET', $url, ['on_stats' =&gt; function (TransferStats $stats) use (&amp;$url) {
                  $url = $stats-&gt;getEffectiveUri();
                  }])-&gt;getBody()-&gt;getContents();
  
                  return $url;
  </code></pre>
  
  <p>Now that $url variable is a GuzzleHttp\Psr7\Uri Object which doesnt really solve my problem as i just need to return the url as a string. </p>
  
  <p>How can i covert the object -></p>
  
  <pre><code>[24-Mar-2017 19:12:26 UTC] GuzzleHttp\Psr7\Uri Object
  (
      [scheme:GuzzleHttp\Psr7\Uri:private] =&gt; https
      [userInfo:GuzzleHttp\Psr7\Uri:private] =&gt; 
      [host:GuzzleHttp\Psr7\Uri:private] =&gt; signup.testapp.com
      [port:GuzzleHttp\Psr7\Uri:private] =&gt; 
      [path:GuzzleHttp\Psr7\Uri:private] =&gt; /login
      [query:GuzzleHttp\Psr7\Uri:private] =&gt; username=jeff&amp;blablablablabla
      [fragment:GuzzleHttp\Psr7\Uri:private] =&gt; 
  )
  </code></pre>
  
  <p>Into a simple string that i can pass on to make another request to?</p>
  
  <p>Or am i missing somthing? getInfo('url') in Guzzle 3 was the perfect solution to a problem surely another one has taken its place?</p>
  
  <p>Thanks</p>