Subject: | Re: HTTP POST
| Date: | 29 Oct 2017 10:31:37 -0400
| From: | "Jim Moseley" <jmose@mapson.triptracker.com>
| Newsgroups: | pnews.paradox-programming
|
Jure,
My guess is that your Content-type is the issue. It should have the \n at
all. Plus, it should probably be application/xml instead of application/html.
If the host is strict, it would ignore invalid content, so it thinks you
didn't pass anything.
Looking more at it, why are you passing xml strings if CURL worked with a
simple 'tag=value' structure? Pass the same text "order_id=44&staus=19".
In this case, you might want application/html but without newline.
Hth,
Jim Moseley
modridirkac" <jure.zorko@gmail.com> wrote:
>I need to send some data to web server with POST method.
>
>I Only have information, that I should send "order_id" and "status".
>I only get ""status_id missing!".
>
>With CURL it works OK:
>curl.exe -d "order_id=44&status=19" -k -X POST https://some web
>store.com/index.php?route=order/manage/updateStatus
>
>What else shoul I do to make my OPAL code POST work?
>
>Thx Jure
>----------------------
>
>method run(var eventInfo Event)
>var
> oaXMLHTTP oleAuto
> RequestURL string
> result string
> isOK logical
> msgStr string
>endvar
> RequestURL = "https://www.some web
>store.com/index.php?route=order/manage/updateStatus"
> result = ""
> isOK = false
>
> msgStr = "<order_id>44</order_id>"
> + "<status_id>19</status_id>"
>
> try
> if oaXMLHTTP.open("Msxml2.XMLHTTP.3.0") then
> oaXMLHTTP^open("POST",RequestURL, false)
> oaXMLHTTP^setRequestHeader("Content-Type", "application/html\n")
> oaXMLHTTP^send(msgStr)
> result = oaXMLHTTP^responseText
> isOK = true
> endif
> onFail
> endTry
> if not isOK then
> errorShow()
> return
> endif
>
> result.view("Returned")
>
>endMethod
>
|