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

curl-and-php

Re: cURLing XML

From: Stephen Buckley <designer_at_passman.com>
Date: Fri, 28 Nov 2003 13:20:37 -0600

Thanx for all the quick and detailed responses, and I appologize for my slow
responses.

> Can you describe this other words or possibly showing us some source code
of
> yours that show how you create this xml data variable?

Well, the xml data is generated using miniXML [
http://minixml.psychogenic.com/index.html ]
Very straight forward. Then, before I cURL the xml variable, I echo the xml
variable, so that I can see what the data is looks like. Here is an example
of the the echo:

<Request>
  <AC>
   <CommonData>
    <CommonMandatory HcsTcsInd="T" MessageType="AC" LangInd="00"
TzCode="706" AuthOverrideInd="N" Version="2" TxCatg="1"
CardHolderAttendanceInd="01">
     <AccountNum AccountTypeInd="91"> 4111111111111111 </AccountNum>
     <POSDetails POSEntryMode="01" />
     <MerchantID> 700000001439 </MerchantID>
     <TerminalID TermEntCapInd="05" POSConditionalCode="59"
CardPresentInd="N" AttendedTermDataInd="01" TermLocInd="01" CATInfoInd="06">
001 </TerminalID>
     <BIN> 000002 </BIN>
     <OrderID> 100021128200300 </OrderID>
     <AmountDetails>
      <Amount> 300 </Amount>
     </AmountDetails>
     <TxTypeCommon TxTypeID="G" />
     <Currency CurrencyCode="840" CurrencyExponent="2" />
     <CardPresence>
      <CardNP>
       <Exp> 0105 </Exp>
      </CardNP>
     </CardPresence>
     <TxDateTime> 1000211282003 </TxDateTime>
    </CommonMandatory>
    <CommonOptional />
    <Auth>
     <AuthMandatory FormatInd="H" />
     <AuthOptional>
      <AVSextended>
       <AVSname> Jon John </AVSname>
       <AVSaddress1> Johnny Appleseed Dr. </AVSaddress1>
       <AVScity> Jon John </AVScity>
       <AVSstate> Jon John </AVSstate>
       <AVSzip> 35412 </AVSzip>
      </AVSextended>
     </AuthOptional>
    </Auth>
    <Cap>
     <CapMandatory>
      <EntryDataSrc> 02 </EntryDataSrc>
     </CapMandatory>
    </Cap>
   </CommonData>
  </AC>
 </Request>

> Are you actually saying you want to send 'POST / AUTHORIZE HTTP/1.0' as a
> request? It is a horrible violation of what HTTP is. Is't it supposed tobe
> POST /AUTHORIZE HTTP/1.0' ?

According the above example, the only thing I can spot is that there is NO
space between the '/' and 'Authorize', correct? I did not realize that
could be a problem. I did change that, but still the problem remains.

> Also, I would recommend you to NOT attempt to fiddle with Content-length
> yourself, as you only risk shooting yourself in the foot. curl is
perfectly
> capable of setting this correctly itself.

I certainly did not know this. That is really great. I had originally
thought I
had read that cURL provides as a default the following modifiable header
bits:
Host, Pragma, Accept, and Expect

> curl doesn't mess it up, curl doesn't touch or fiddle with it at all. It
> passes along *exactly* what you passed on to it. If there's any "messing
up"
> going on, it is made by your PHP program or something.

I figure it certainly must be a problem on my end. It helps to know that
cURL passes the variable *exactly* as it exists. For some reason, to me,
the documentation never flatly indicates that.

> You don't seem to know what kind of data your server-end expects?

The documentation they provide includes the .dtd template for formatting of
the xml data. They then give sample xml data(basically the same as shown
above), and also show the header info. I was even provided with, what I
believe is ASP, code that will do the job that I'm attempting; it is just
that my entire app is PHP/mySQL and I really want to keep it that way. I
want to cURL it.

thank you all again,
Stephen

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
Received on 2003-11-28