cURL / Mailing Lists / curl-and-php / Single Mail


Re: Need to pull header fields out of https post reply

From: Martin Turner <>
Date: Thu, 21 Nov 2002 14:21:42 -0800

Jermoe suggested the following code:

If you want to get the header field content, use CURLOPT_HEADER as follows:

$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL,
curl_setopt ($ch, CURLOPT_HEADER, 1);
$string = ob_get_contents();

You get in $string the header field content and the response from the
server. Then you just have to extract the information
that you need with strpos and substr, or preg_match_all.

Hope this helps.


It works for a non-SSL site. But with the site I listed above,
I get nothing back from the SSL site. From a browser, I do get back a body
saying invalid username,password but from within my php script, nothing
comes back. I noticed that the web server I am running from is using libcurl
7.8 with Redhat 7.2 and openssl 0.9.6b. So is the only problem that my web
server needs to be updated to libcurl 7.10.2? What is the minimum version of
libcurl needed to do https??

>From: "Martin Turner" <>
>Subject: Need to pull header fields out of https post reply
>Date: Thu, 21 Nov 2002 01:23:59 -0800
>I am trying to write the cURL code to connect to Authorize.Net's SSL
>gateway. I think I have got the first part under control. In my php script
>on my web server, I used the code fragment:
>$ch = curl_init();
>curl_setopt($ch, CURLOPT_URL,
>I did have a few more lines to open/create a file on my web server and
>write the response into there, but that was causing errors when the
>web server tried to write out many image files that didn't exist on my
>machine. This is a win32 platform with write access to that dir. So
>I removed that portion from the script.
>What I want to do is read the header field contents that come back, parse
>certain fields, and then prepare my html response for the client browser.
>Is there an easy way to do this? Any code examples would be appreciated. I
>am a newcomer to php and cURL.
>MSN 8 with e-mail virus protection service: 2 months FREE*
>This email is sponsored by:ThinkGeek
>Welcome to geek heaven.

MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.

This email is sponsored by:ThinkGeek
Welcome to geek heaven.
Received on 2002-11-21