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

curl-and-php

HTTPS, CURL Binary/CURL PHP Functions

From: Samantha Savvakis <samantha_at_cfs.net.au>
Date: Wed, 15 Aug 2001 13:48:19 +1000

Hi,

Version details:
SCO OpenServer 5.0.6
APACHE 1.3.20
PHP 4.0.6 - compiled with curl, openssl. I have a PHP binary installed,
aswell as compiled as a module in Apache.
CURL 7.8
OPENSSL 0.9.6

curl --version
curl 7.8 (i686-pc-sco3.2v5.0.6) libcurl 7.8 (OpenSSL 0.9.6)

I'm posting XML data to a HTTPS site. I took an example from the PHPBuilder
web site using the curl binary, and modified it for my test:

#!/usr/local/bin/php -q
<?
        $strLogonXML = "<?xml version='1.0'?>";
        $strLogonXML .= "<LOGON_SUB>";
        $strLogonXML .= "<LOGIN>xxxL</LOGIN>";
        $strLogonXML .= "<PASSWORD>xxx</PASSWORD>";
        $strLogonXML .= "</LOGON_SUB>";

        $URL="https://someurl/page.asp";

        exec("/usr/local/bin/curl -m 120 -d \"$strLogonXML\"
$URL -L -s",$returnarray, $returncode);

        for ($i = 0; $i < count($returnarray); $i++)
        {
            printf("%s\n", $returnarray[$i]);
        }
?>

This works well. I receive XML back from the HTTPS site as expected.

So I decided to try to PHP Curl functions:

#!/usr/local/bin/php
<?
        $strLogonXML = "<?xml version='1.0'?>";
        $strLogonXML .= "<LOGON_SUB>";
        $strLogonXML .= "<LOGIN>xxxL</LOGIN>";
        $strLogonXML .= "<PASSWORD>xxx</PASSWORD>";
        $strLogonXML .= "</LOGON_SUB>";

        $URL="https://someurl/page.asp";

        $csess = curl_init();
        curl_setopt($csess, CURLOPT_URL, $URL);
        curl_setopt($csess, CURLOPT_TIMEOUT, 120);
        curl_setopt($csess, CURLOPT_POST, 1);
        curl_setopt($csess, CURLOPT_POSTFIELDS, $strLogonXML);
        curl_setopt($csess, CURLOPT_FOLLOWLOCATION, 1);

        $result = curl_exec($csess);
        curl_close($csess);

        echo("Result = $result\n");
?>

All the options I have set using curl_setopt are the equivalent options that
I've set on the "curl" binary command line. This does not work, and I have
no result returned from the HTTPS server.

Is there something I'm missing using the PHP functions?

Thanks,
Sam

_______________________________________________
Curl-and-php mailing list
http://curl.haxx.se/
Received on 2001-08-15