Link to home
Start Free TrialLog in
Avatar of andreshm
andreshmFlag for United States of America

asked on

POSTING to URL through ASP

HI.
Is there any possible way (without dll's or extra software) to "simulate" or replace a form (a regular one, method=POST) by an ASP script ?
I just want to get into that page, grab some variables  and post tehm to an external URL immediately, and I just want to make It "invisible" for curious people.
I dont want to pass them using the URl?variable=123,

I've been trying to search the way to do it, but haven;t found anything.
PLz Help
thanks
Avatar of whammy
whammy

You mean like:

<img src="somepage.asp?variable1=<% = variable1 %>&variable2=<% = variable2 %>" width="1" height="1" alt="" />

?

That's what is called a "tricky pixel"...
Avatar of andreshm

ASKER

I mean
to Change this (i.e.)
<form method="POST" action="URLHERE" name="whatever">
<input name="ZIp" type="hidden" value="<%=VAR%>">
<input name="website" type="hidden" value="<%=website %>">
</form>
by an ASP script that submits that form automatically. No user intervention . I know how to do that using javascript, but don;t want to use it and besides If someone checks the source from the page I don;t want them to know what is on the form and where is going to.

thanks
Exactly, that's what the tricky pixel does.
P.S. Except you'd use the "GET" method, with Request.QueryString() on your page.

The fake image sends that stuff to your page through the querystring without the user seeing it. Of course, you're limited to whatever information you can put in the querystring, same as you would be with a hidden form.
Well, I tried your method, and it seems it's not working for my purposes. The problem is that using this wont't trigeer the action on the other page... I have to post the variables to a CGI script in another server, who evaultes the variables and take an action, ( it gest me to the URL "b" or URL "B" after that.
thanks
What exactly are you trying to do? I don't mean your method of posting the form, I mean what are you really trying to do? :)
ok. here I go again
as far as I know there are two methods to send the information using a form: GET and POST.
A form using GET can be Easily simulated on asp with and "autosend" using  Response.Redirect("teform.asp?var1=xxxx&var2=asdasd"). It takes me to theform.asp and makes whatever it needs to do.
OK?
NOw What happens if I need to POST these variables, and send them automatically? I just need to because Is the only method accepted by the remote server script, besides is a little more secure.

Thanks.
You can simulate a FORM POST using Microsoft.ServerXMLHTTP.

Basically, you connect to another server, and send a POST message using XMLHTTP.  Here are a number of references to get  you started.  After you look at these, if you have any follow-up questions feel free to post them here.

Best Regards,
apollois

~~~~~~~~~~~~~~~~~~~~~
Here is an example:
~~~~~~~~~~~~~~~~~~~~~
This uses the GET method, but the POST is very similar.

==============================================================
<%@ Language="VBScript" %>
<%
     Dim objSvrHTTP
     Dim PostData
     
     Set objSvrHTTP = Server.CreateObject("Msxml2.ServerXMLHTTP.4.0")
     objSvrHTTP.open "GET", "http://search.atomz.com/search/?sp-a=sp10009b2d&sp-q=binary", false

     objSvrHTTP.send
     Response.Write objSvrHTTP.responseText
%>
=================================================================

~~~~~~~~~~~~~~~~~~~~~~~~~
For details, please see:
~~~~~~~~~~~~~~~~~~~~~~~~~

Frequently Asked Questions about ServerXMLHTTP
http://support.microsoft.com/default.aspx?scid=kb;EN-US;290761

ServerXMLHTTP 4.0 Object Documentation
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/htm/xml_obj_iserverxmlhttprequest_5115.asp

MSXML 4.0 SDK Documentation
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/htm/sdk_intro_6g53.asp?frame=true

ServerXMLHTTP 4.0 Example and Docs - PerfectXML.com
http://www.perfectxml.com/msxmlHTTP.asp


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Here's where to get the latest version
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

MSXML 4.0 SP 1 (Microsoft XML Core Services)
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=0CDD34BF-50EA-4238-846B-243C58FF224A

Microsoft XML Core Services 4.0 SP1
http://msdn.microsoft.com/downloads/default.asp?url=/downloads/sample.asp?url=/msdn-files/027/001/766/msdncompositedoc.xml



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TROUBLESHOOTING
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Proxy Configuration Utility Must Be Run for ServerXMLHTTP to Work
http://support.microsoft.com/default.aspx?scid=kb;EN-US;289481

Download Proxycfg.Exe From Following MSDN Web Site At:
http://msdn.microsoft.com/code/sample.asp?url=/msdn-files/027/001/468/msdncompositedoc.xml

ASKER CERTIFIED SOLUTION
Avatar of apollois
apollois

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
THANKS!
You're welcome!

So, does this answer your question?

Best Regards,
apollois
exactly what I was looking for. thanks