|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Newbie question- how to POST?
I'm normally a perl programmer. What I need to do is POST
Code:
<TransactionRequest> **<Function ID="SOME_ID" Value="Function_Name"> ****<Authorization> ******<Account>Your_Account_Name</Account> ******<Password>Your_Password<Password> ****</Authorization> ****<Data> ******<Field1>Data1</Field1> ******<Field2>Data2</Field2> ******<FieldN>DataN</FieldN> ****</Data> **</Function> </TransactionRequest> to https://somedomain.com/somescriptXML.pl I just don't understand that, I'm guessing it's very simple though... (How exactly would I POST the XML and please give me an example). Thanks! |
|
#2
|
|||
|
|||
|
You say you're normally a PERL programmer, but you don't mention what sort of environment you're working in now. As an example, if you're working with classic ASP/vbscript:
Code:
dim xmlhttp 'xmlhttp request object
dim xmlRequest, xmlResponse 'variables to hold the request and response respectively
dim tst 'test variable to hold result of assigning the response to xmlResponse
'build xml request string. This is where you'd put the XML data You need to post to the server
xmlRequest="<TransactionRequest>...</TransactionRequest>"
set xmlhttp = server.Createobject("MSXML2.ServerXMLHTTP")
xmlhttp.Open "POST","https://somedomain.com/somescriptXML.pl",false
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xmlhttp.send xmlRequest 'submit request
'Assign Response string to free threaded DOM object
set xmlResponse = Server.CreateObject("MSXML.FreeThreadedDOMDocument")
xmlResponse.async = false
tstload = xmlResponse.loadxml(xmlhttp.ResponseXML.XML)
set xmlhttp = nothing
Chris Collins crcdesign.net |
|
#3
|
|||
|
|||
|
Uh, oh. That doesn't really make sense to me. I don't know anything about ASP. I do HTML and Perl, I can read PHP. What I do is take values from a form, use perl to format the XML based on the values, and then POST that XML to http://somedomain/someXMLscript.pl
|
|
#4
|
|||
|
|||
|
Quote:
Written another way in Javascript (taking ChrisRC's example): PHP Code:
I'm not sure if that's 100% -- but I think it's close... |
|
#5
|
|||
|
|||
|
Quote:
OK. There probably is a way to do it in PERL, but I haven't used PERL in 10 years so I honestly can't help you much there from experience. A quick search though, did turn up the HTTP::Request class which seems like the obvious solution. [edit]Actully I took a longer look at my search results and found an example from Ebay's developer guide[/edit] I'm pretty sure the typical way to do this with PHP is by using the socket functions. A quick search turned up an example at PHPBuilder Chris Collins crcdesign.net Last edited by ChrisRC : August 27th, 2004 at 09:19 AM. Reason: Found more info |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > Newbie question- how to POST? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|