|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48550 cURL does not work when the URL has a ’ character in it.
Submitted: 2009-06-14 17:13 UTC Modified: 2009-06-15 17:51 UTC
From: victorepand at gmail dot com Assigned:
Status: Not a bug Package: cURL related
PHP Version: 5.2.9 OS: FreeBSD
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: victorepand at gmail dot com
New email:
PHP Version: OS:


 [2009-06-14 17:13 UTC] victorepand at gmail dot com
cURL does not work when the URL has a ’ character in it. Such as, for example, this one:’s_GM17_Derk_Open-Face_Helmet.jpg

Reproduce code:
$result=curl_exec ($ch);

Expected result:
thumbnail image in binary stored in result

Actual result:
curl error


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-06-15 14:31 UTC]
What error does it give? See
 [2009-06-15 15:50 UTC] victorepand at gmail dot com
The error returned by cURL is:
22 The requested URL returned error: 404

I created this function which solves the problem:

function urlencode_url($url) {
   if (!($ei=strpos($url,"?"))) $ei=strlen($url);
   return $newurl;

By passing the URL through this function, the offending character is converted to its urlencoded equivalent (%##). With these codes instead of the bad character, cURL reads the URL with no problem.

Nonetheless, I reported this issue because Internet Explorer does not require the urlencoded codes. It loads the original URL with no problem, using the original bad character in the URL. Therefore, the cURL behavior is more strict in its requirement of the URL being urlencoded than Internet Explorer is.

Perhaps cURL could automatically urlencode the URL, or perhaps a function should be made for this purpose like the one I have shown above.
 [2009-06-15 17:51 UTC]
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..)
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Thu Aug 13 08:01:24 2020 UTC