Bug #75829 [Com]: cURL and file_get_contents does not work with URL containing special character
| From: | marco dot marsala at live dot it | Date: | Wed, 09 May 2018 10:02:29 +0000 |
| Subject: | Bug #75829 [Com]: cURL and file_get_contents does not work with URL containing special character | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-215173@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75829&edit=1
ID: 75829
Comment by: marco dot marsala at live dot it
Reported by: marco dot marsala at live dot it
Summary: cURL and file_get_contents does not work with URL
containing special character
Status: Not a bug
Type: Bug
Package: URL related
Operating System: both Ubuntu and Windows
PHP Version: 7.2.1
Block user comment: N
Private report: N
New Comment:
You're right, but it seems fixed with cUrl 7.52.1. The test script is working now.
Previous Comments:
------------------------------------------------------------------------
[2018-01-17 08:35:08] requinix@php.net
I get an error page if I try visiting that URL in a browser: "Nessuna vendita individuata"
/ No sale specified
Either your URL is wrong, or you need to think about string encodings (URLs are supposed to be
UTF-8), or you need be using some sort of escaping on the apostrophe (percent-encoding?), or if you
got that page via a form submission then you need to replay the form submission in code, or
something else I don't know since I can't even find the right page through Google.
------------------------------------------------------------------------
[2018-01-17 08:15:37] spam2 at rhsoft dot net
the problem lis NOT in DOMDocument->loadHTMLFile() too, it is that you don't escape your
input proper which is your job as programmer be it for SQL, URL's or whatever and the idea that
this is a bug in a programming language is wrong from the start
frankly you even refer to https://bugs.php.net/bug.php?id=48550
[2009-06-15 17:51 UTC] jani@php.net
Well, browsers do a lot of thing automatically you need to do yourself
when you do it yourself. This is obviously not any bug. (tested with
curl on command line with same result..)
------------------------------------------------------------------------
[2018-01-17 08:09:15] marco dot marsala at live dot it
I agree with you that is a bad practice to have such characters in URL, but sometimes you have to
interact with external websites that use such characters in their URLs (for example when writing a
scraper).
Btw, the problem is on DOMDocument->loadHTMLFile() too
------------------------------------------------------------------------
[2018-01-17 08:00:04] spam2 at rhsoft dot net
https://en.wikipedia.org/wiki/Garbage_in,_garbage_out
PHP is a programming language and not a artificial intelligence hence you are responsible as
programmer to encode input as needed and have such chars in a URL/filename is bad practice anyways
------------------------------------------------------------------------
[2018-01-17 07:59:09] marco dot marsala at live dot it
I don't think is a duplicate of #48550 but a much broader vision of the issue.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=75829
--
Edit this bug report at https://bugs.php.net/bug.php?id=75829&edit=1