php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10211 CURLOPT_HTTPHEADER does not work
Submitted: 2001-04-06 11:31 UTC Modified: 2001-04-21 18:37 UTC
From: cleesmith at hotmail dot com Assigned:
Status: Closed Package: cURL related
PHP Version: 4.0.4pl1 OS: Windows 2000
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: cleesmith at hotmail dot com
New email:
PHP Version: OS:

 

 [2001-04-06 11:31 UTC] cleesmith at hotmail dot com
Also, noticed that CURLOPT_HTTPHEADER and CURLOPT_HEADER have the same value.
Using curl -H "UID: spud" http://... works properly.
Except for CURLOPT_HTTPHEADER and chopping off 2 bytes at the end of a CURLOPT_RETURNTRANSFER ... everything works great.
Here's my script:
<?php
$url = "http://localhost/perl-bin/mod_perl_test.pl";
$user_agent = "VanillaZilla/2001";

$ch = curl_init();
curl_setopt ($ch, CURLOPT_HTTPHEADER, "UID: spud");
curl_setopt ($ch, 23, "UID: spud");
echo "after CURLOPT_HTTPHEADER(".CURLOPT_HTTPHEADER." CURLOPT_HEADER=".CURLOPT_HEADER."):<br>";
echo "curl_errno=". curl_errno($ch) ."<br>";
echo "curl_error=". curl_error($ch) ."<br>";
curl_setopt ($ch, CURLOPT_VERBOSE, 1);
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_HEADER, 1);
curl_setopt ($ch, CURLOPT_USERAGENT, $user_agent);
curl_setopt ($ch, CURLOPT_COOKIE, "spud=tater;tater=spud"); 
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, "pass=spud&data=stuff&case=en");
$result = curl_exec ($ch);
echo "after curl_exec:<br>";
echo "curl_errno=". curl_errno($ch) ."<br>";
echo "curl_error=". curl_error($ch) ."<br>";
curl_close ($ch);

print "<hr><pre>";
echo $result . "<br>";
print "</pre>";
?>
thanks.
chris  cleesmith@hotmail.com

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-04-06 11:35 UTC] sniper@php.net
This should be fixed in CVS. Please try the latest snapshot
from http://snaps.php.net/

--Jani

 [2001-04-06 11:35 UTC] sniper@php.net
Or as you have windows, try latest build from http://www.php4win.de/

--Jani

 [2001-04-08 18:03 UTC] cleesmith at hotmail dot com
I downloaded the 4.0.5RC1 binary from http://www.php4win.de/, but it doesn't work either.  Although, it looks like the values for CURLOPT_HTTPHEADER and CURLOPT_HEADER are now correct.

Then I went to http://snaps.php.net/ and grabbed the source 4.0.6 (I think it is), which compiled ok.  Then I grabbed cURL from http://curl.haxx.se/, but I'm unable to get that to compile to a DLL (despite several attempts). Any suggestions would be appreciated.
thanks for your quick response.
chris
 [2001-04-08 18:04 UTC] cleesmith at hotmail dot com
I downloaded the 4.0.5RC1 binary from http://www.php4win.de/, but it doesn't work either.  Although, it looks like the values for CURLOPT_HTTPHEADER and CURLOPT_HEADER are now correct.

Then I went to http://snaps.php.net/ and grabbed the source 4.0.6 (I think it is), which compiled ok.  Then I grabbed cURL from http://curl.haxx.se/, but I'm unable to get that to compile to a DLL (despite several attempts). Any suggestions would be appreciated.
thanks for your quick response.
chris
 [2001-04-21 18:37 UTC] cleesmith at hotmail dot com
I have given up on this one, and will just use fsockopen instead ... or switch to Java :-)
Sorry about the double posting.
thanks again.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 14:01:29 2024 UTC