Created
January 15, 2014 10:18
-
-
Save Thinkscape/8433897 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include "vendor/autoload.php"; | |
$url = 'https://github.com?abc'; | |
$client = new Guzzle\Http\Client(); | |
$req = $client->get($url); | |
var_dump("The url we are looking for: $url"); | |
var_dump("The url after parsing: " . $req->getUrl(false)); | |
if($url !== $req->getUrl(false)){ | |
echo "URL has been broken during parsing\n"; | |
} else { | |
echo "All is good\n"; | |
} | |
$url = \Guzzle\Http\Url::factory('https://github.com'); | |
$url->setQuery([100 => \Guzzle\Http\QueryString::BLANK]); | |
var_dump('Url before sending: ' . $url); | |
$req = $client->get($url); | |
var_dump('Url after sending: ' . $req->send()->getEffectiveUrl()); | |
if((string)$url !== $req->getResponse()->getEffectiveUrl()){ | |
echo "URL has been changed when sending request!\n"; | |
} else { | |
echo "All is good\n"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string(50) "The url we are looking for: https://github.com?abc" | |
string(46) "The url after parsing: https://github.com?abc=" | |
URL has been broken during parsing | |
string(42) "Url before sending: https://github.com?100" | |
string(42) "Url after sending: https://github.com?100=" | |
URL has been changed when sending request! | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment