note 53445 added to ref.curl
| From: | michaeledwards dot com at osu1 dot php dot net | Date: | Wed, 01 Jun 2005 21:57:06 +0000 |
| Subject: | note 53445 added to ref.curl | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-89755@lists.php.net to get a copy of this message | ||
Problems can occur if you mix CURLOPT_URL with a 'Host:' header in CURLOPT_HEADERS on
redirects because cURL will combine the host you explicitly stated in the 'Host:' header
with the host from the Location: header of the redirect response.
In short, don't do this:
$host = "www.dontusehostheaders.com";
$url = "http://$host/";
$headers = array("Host: $host");
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
Do this instead:
$host = "www.dontusehostheaders.com";
$url = "http://$host/";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
----
Manual Page -- http://www.php.net/manual/en/ref.curl.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+53445
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53445&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53445&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53445&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53445&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53445&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+53445&report=yes
Search -- http://master.php.net/manage/user-notes.php