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

curl-and-php

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

From: Fluteau Jerome ICM N PG U PLM A 2 <jerome.fluteau_at_siemens.com>
Date: Thu, 21 Nov 2002 14:41:45 +0100

>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.

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

$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL,
"https://secure.authorize.net/gateway/transact.dll");
curl_setopt ($ch, CURLOPT_HEADER, 1);
ob_start();
curl_exec($ch);
$string = ob_get_contents();
ob_end_clean();
curl_close($ch);

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.

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2002-11-21