posting to one web site from another
Phil Davis
revdev at pdslabs.net
Thu Apr 10 21:37:18 EDT 2014
Here is how I solved this problem:
* created an HTML 'template' file containing a form with merge points
and JS that submits the form before page load
* merged values into the page
* put the page
'putting' the merged page submits the form to the target web site takes
the user there in their browser, and that's what I wanted.
Here is the html 'template' page (with names changed to protect the
innocent):
-------- start of page --------
<HTML>
<HEAD LANG="en">
<TITLE>cTRAIN Web</TITLE>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="robots" content="noindex,nofollow">
</HEAD>
<style type="text/css">
@media screen {
body {
background-color: #000;
min-width: 960px;
}
</style>
<BODY>
<form id='postback' action='[[gMyArray["URL"] ]]' method='POST'>
<input id='My_ID' type="hidden" name="ID"
value='[[gMyArray["ID"] ]]' />
<input id='My_project_id' type="hidden" name="project_ID"
value='[[gMyArray["project_ID"] ]]' />
<input id='My_params' type="hidden" name="params"
value='[[gMyArray["params"] ]]' />
</form>
<script
type="text/javascript">document.getElementById('postback').submit();</script>
</BODY>
</HTML>
--------- end of page --------
There you have it -
Phil Davis
On 4/9/14, 5:51 PM, Phil Davis wrote:
> Hi folks,
>
> Here's my problem:
> My LC server code needs to post some items to certain page of another
> web site and actually go to that page in the process. I find that I
> can post to that page just fine, but then the urlResponse contains the
> rendered page (as you would expect). If I 'put' it, the page is
> displayed correctly in the browser but under the URL of my site. Not
> what I wanted! I want my data to be posted to the offsite page, and in
> response I want that page to show up in the user's browser under that
> page's correct URL.
>
> I assume there's something I need to do with HTTP headers, but I don't
> quite know what. Or maybe not. However, I bet someone within the reach
> of this email often solves this kind of problem before breakfast, the
> way some people do puzzles or read the paper (do people still do that?).
>
> Any direction you can offer will be received with much gratitude.
>
--
Phil Davis
More information about the use-livecode
mailing list