This commit is contained in:
ArthurHoaro 2016-05-05 13:28:43 +02:00
parent 86deafe0ff
commit caa69b5853
3 changed files with 5 additions and 5 deletions

View File

@ -27,7 +27,7 @@
function get_http_response($url, $timeout = 30, $maxBytes = 4194304)
{
$urlObj = new Url($url);
$cleanUrl = $urlObj->indToAscii();
$cleanUrl = $urlObj->idnToAscii();
if (! filter_var($cleanUrl, FILTER_VALIDATE_URL) || ! $urlObj->isHttp()) {
return array(array(0 => 'Invalid HTTP Url'), false);
@ -70,7 +70,7 @@ function get_http_response($url, $timeout = 30, $maxBytes = 4194304)
* Retrieve HTTP headers, following n redirections (temporary and permanent ones).
*
* @param string $url initial URL to reach.
* @param int $redirectionLimit max redirection follow..
* @param int $redirectionLimit max redirection follow.
*
* @return array HTTP headers, or false if it failed.
*/

View File

@ -240,7 +240,7 @@ class Url
*
* @return string converted cleaned up URL.
*/
public function indToAscii()
public function idnToAscii()
{
$out = $this->cleanup();
if (! function_exists('idn_to_ascii') || ! isset($this->parts['host'])) {

View File

@ -190,10 +190,10 @@ class UrlTest extends PHPUnit_Framework_TestCase
$ind = 'http://www.académie-française.fr/';
$expected = 'http://www.xn--acadmie-franaise-npb1a.fr/';
$url = new Url($ind);
$this->assertEquals($expected, $url->indToAscii());
$this->assertEquals($expected, $url->idnToAscii());
$notInd = 'http://www.academie-francaise.fr/';
$url = new Url($notInd);
$this->assertEquals($notInd, $url->indToAscii());
$this->assertEquals($notInd, $url->idnToAscii());
}
}