note 126996 added to function.parse-url
| From: | pjpawel at main dot php dot net | Date: | Tue, 19 Apr 2022 08:06:54 +0000 |
| Subject: | note 126996 added to function.parse-url | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-218296@lists.php.net to get a copy of this message | ||
Unfortunately parse_url() DO NOT parse correctly urls without scheme or '//'. For example
'www.xyz.com' is consider as path not host:
Code:
<?php
var_dump(parse_url('www.xyz.com'));
?>
Output:
array(1) {
["path"]=>
string(10) "www.xyz.com"
}
To get better output change url to:
'//www.xyz.com' or 'http://www.xyz.com'
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.135 (proxied: 79.184.48.77)
----
Manual Page -- https://php.net/manual/en/function.parse-url.php
Edit -- https://main.php.net/note/edit/126996
Del: integrated -- https://main.php.net/note/delete/126996/integrated
Del: useless -- https://main.php.net/note/delete/126996/useless
Del: bad code -- https://main.php.net/note/delete/126996/bad+code
Del: spam -- https://main.php.net/note/delete/126996/spam
Del: non-english -- https://main.php.net/note/delete/126996/non-english
Del: in docs -- https://main.php.net/note/delete/126996/in+docs
Del: other reasons-- https://main.php.net/note/delete/126996
Reject -- https://main.php.net/note/reject/126996
Search -- https://main.php.net/manage/user-notes.php