parse_url not working properly in 5.3
Question
I need to parse the url in php. The url starts with // is parsing correctly in php 5.5 but not in 5.3. php 5.3 does return "host" as null and it returns domain with path in "path". I am getting the url form remote site. I am also getting the url like "//images/mdb_shoppingBag.png". For this I need to add the host name before the url. So, I can't add http://. Is there any solution?
<?php
$sty = '//dimg.dillards.com/is/image/DillardsZoom/03707963_zi?$c7product$';
print_r( parse_url($sty) );
?>
And the output is
in PHP 5.5
Array ( [host] => dimg.dillards.com [path] => /is/image/DillardsZoom/03707963_zi [query] => $c7product$ )
in PHP 5.3
Array ( [path] => //dimg.dillards.com/is/image/DillardsZoom/03707963_zi [query] => $c7product$ )
Pas de solution correcte
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow