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

curl-and-php

Antw: Re: a question about curl and php

From: Zheng Sun <Zheng.Sun_at_SCHOBER.DE>
Date: Fri, 28 Feb 2003 09:51:59 +0100

many thanks !

I am definately sure the strings to be post are correct. I used fopen() to realize
the function before which works very well. pls take a look. it is for http, however,
i need https as well which can only be done by curl as the php.net said..

#-----------------------------------------------------------------------------------------------
    $host = "http://www.schober.com";
    
    $XMLRequest = '<?xml version="1.0" encoding="ISO-8859-1"?>
    <AddressMessage xmlns="http://paymaster.schober.com/AddressMessage">
      <Header>
        <Activity/>
        <ClientId>web-test</ClientId>
        <TransactionId>1234-consumer</TransactionId>
      </Header>
      <Body>
        <Address>
                <Street>'.$street.'</Street>
                <StreetNumber>'.$streetnumber.'</StreetNumber>
                <ZIP>'.$zip.'</ZIP>
                <City>'.$city.'</City>
                <Country>'.$country.'</Country>
        </Address>
        <Person>
          <FirstName>Manfred</FirstName>
          <LastName>Schrems</LastName>
        </Person>
      </Body>
    </AddressMessage>';

    $data = "ServiceId=".$ServiceId."&XMLRequest=".$XMLRequest;
    $len = strlen($data);
    $fp = fsockopen("sdm-bm1.schober.de", 8080, &$errno, &$errstr);
    
    if ($fp)
    {
      fputs($fp, "POST $host/pm/FormRequestListener HTTP/1.1\n");
      fputs($fp, "Authorization: Basic ".base64_encode("nick:pwd")."\n");
      fputs($fp, "Host: sdm-bm1.schober.de\n");
      fputs($fp, "Content-length: $len\n");
      fputs($fp, "Content-Type: application/x-www-form-urlencoded\n");
      fputs($fp, "Connection: Close\n\n");
      fputs($fp, "$data\n\n");
      
      $str = "";
      $msg = "";
  
      while (!feof($fp))
      {
        $str = $str.fgets($fp,128);
      }

      fclose($fp);

#---------------------------------------------------------------------------------

>>> withnall_at_connexus.net.au 02/28 7:26 >>>
have a look at your post string and make sure its valid.
by the looks of it theres a lot of characters in there that don't look like
they're urlencoded.

At 01:43 PM 27/02/2003 +0100, Zheng Sun wrote:
>$XMLRequest = '<?xml version="1.0" encoding="ISO-8859-1"?>\n';
>$XMLRequest .= '<AddressMessage
>xmlns="http://paymaster.schober.com/AddressMessage">\n';
>$XMLRequest .= ' <Header>\n';
>$XMLRequest .= ' <Activity/>\n';
>$XMLRequest .= ' <ClientId>web-test</ClientId>\n';
>$XMLRequest .= ' <TransactionId>1234-consumer</TransactionId>\n';
>$XMLRequest .= ' </Header>\n';
>$XMLRequest .= ' <Body>\n';
>$XMLRequest .= ' <Address>\n';
>$XMLRequest .= ' <Street>street</Street>\n';
>$XMLRequest .= ' <StreetNumber>9</StreetNumber>\n';
>$XMLRequest .= ' <ZIP>72076</ZIP>\n';
>$XMLRequest .= ' <City>Tuebingen</City>\n';
>$XMLRequest .= ' <Country>DE</Country>\n';
>$XMLRequest .= ' </Address>\n';
>$XMLRequest .= ' <Person>\n';
>$XMLRequest .= ' <FirstName>Manfred</FirstName>\n';
>$XMLRequest .= ' <LastName>Schrems</LastName>\n';
>$XMLRequest .= ' </Person>\n';
>$XMLRequest .= ' </Body>\n';
>$XMLRequest .= '</AddressMessage>\n';
>
>$ServiceId = 'urn:com.schober:paymaster.ConsumerAddressCheck_Tst';
>#$ServiceId = 'urn:com.schober:paymaster.ConsumerAddressValidation_Tst';
>
>$data_string = "ServiceId=".$ServiceId."&XMLRequest=".$XMLRequest;

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2003-02-28