I need to POST information to a web site and fill out multiple pages of data to create a new account. Using FireFox + Firebug, I'm able to see how the interaction with the web site is working and now I want to do the same thing in LiveCode, but I'm running into a knowledge issue.
This is the sequence that I'm trying to replicate.
GET RegistrationLogIn web page (working)
Pull data off this page (working)
POST data to "http://192.168.1.40/membership/plan/1" status=303 see other
GET "http://192.168.1.40/co-op-dashboard/registration/step/1" status=303 see other
GET "http://192.168.1.40/co-op-dashboard/registration/step/1" status=200 OK
Here is my code to do the POST.
Code: Select all
-- Build the POST Header
put Empty into tHTTPHeaders
put HTML.AddHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8") after tHTTPHeaders
put HTML.AddHeader("Accept-Encoding", "none") after tHTTPHeaders
put HTML.AddHeader("Accept-Language", "en-US,en;q=0.5") after tHTTPHeaders
put HTML.AddHeader("Connection", "keep-alive") after tHTTPHeaders
put HTML.AddHeader("Host", cHost ) after tHTTPHeaders
put HTML.AddHeader("Referrer", cHostUrl & "/membership/plan/login/1") after tHTTPHeaders
put HTML.AddHeader("Content-length", the length of tCommandValue ) after tHTTPHeaders
put HTML.AddHeader("Content-Type", "application/x-www-form-urlencoded") after tHTTPHeaders
set the httpheaders to tHTTPHeaders
if tActionValue contains cHostUrl then
put tActionValue into tTargetUrl
else
put cHostUrl & tActionValue into tTargetUrl
end if
post tCommandValue to URL tTargetUrl
put it into myResult
put the result into tRslt
result = error Redirect failed /co-op-dashboard/registration/steps/1 - invalid URL: /co-op-dashboard/registration/steps/1
QUESTION: Where do you get the HTTP response Status? Expected to see "303 see other" The "it" response was blank
QUESTION: Is there any way to get the HTTP response Header to get the redirect Location: string?
I tried to use the invalid URL string as the redirect location, but that gave me a different redirect to a completely different location.
The only think I haven't been able to include in the HEADER is a Cookie string which I haven't been able to figure out where to pick that up.
Thanks for the HELP