• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 283
  • Last Modified:

HTTP_GET with asp

Hi all,

In server side scripting languages such as Cold Fusion or tcl there are API available that allow you to open an http connection and fetch the contents of a remote page, set the return of that connection to a variable and then write that variable to the page as if that content were a part of your page.

I've used this technique many times with partner generated content with both of the aforementioned languages and I'm curious if it can be easily done with asp.

A code example of how this can be done would be great, in fact, required considering the amount of points i'm offering :)

Thanks in advance for all help.
0
SGC
Asked:
SGC
  • 6
  • 6
  • 3
  • +2
1 Solution
 
fallon12345Commented:
I am a CF user as well, and am disappointed that there is not a way to do this in ASP.  That is one reason way I like CF better than ASP, that functionality is incredibly powerful, but seemingly impossible in ASP.  
0
 
RafalUSACommented:
All you do is create a form

<form name="MyForm" action="next.asp" method="get">

<input type="hidden" value="123" name="str123">
<input type="submit" name="submit" value="submit">

</form>


next.asp:

<%= Request.QueryString("str123") %>



Thats all you need. this will print the value of str123 which is "123"
If you change the method from GET to POST change the asp page to:

<%= Request.Form("str123") %>
0
 
makerpCommented:
i have written a server side comopenet which does exactly this. heres my asp for it,  simple ahhh

any way there are some fully tested componenets avalible for use. you will have to register the .dll on the server in order to use and also find the 'prog id' in order to use create object on it,i would like to offer you mine but there's still lots to do on it (im woking on a binary fetch at the minuete)

most other components to do this follow the same standard of methods as bellow.

of the top of my head i dont know a url for a com but have a quick look on asp101 etc. itll be on there  

Set obj = Server.CreateObject("WebTools.HttpRequest.1")

      obj.OpenUrl "http://beagle.bracknell.bt.co.uk/",7
      response.write("<BR>GetStatus : " & obj.GetStatus())
      response.write("<BR>GetContentLength : " & obj.GetContentLength())
      response.write("<BR>GetContent :" & obj.GetContent())
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
RafalUSACommented:
Ops, i just realized this won't help :)
0
 
makerpCommented:
eemmmmm,,

RafalUSA...... pardon :)

i think you are reading a different Q
0
 
nozlabCommented:
ok, this is ugly, but I'm sure you can figure it out.

Let's say you have a form

---Begin input.htm---
<form action="output.asp" name=FORM1 id=FORM1 method="get">
<input name=myText id=myText>
<input type="submit" name="submit">
</form>
---END input.htm---

---Begin output.asp---
<%@ Language=VBScript %>
<html>
<body>
This is your value : <%=request.querystring("myText")%>
<P>
or<P>
<%
response.write("This is your value : " & request.querystring("myText"))
%>
</body>
</html>

---End output.asp---
0
 
makerpCommented:
nozlab,,,,

i think this is not what SGC is looking for at all

:)

have you read the question and the history ?
0
 
makerpCommented:
SGC

heres a free componenet for this

http://www.dynu.com/DynuHttp.htm

heres an example

<%
REM Create the object
Set myhttp = Server.CreateObject("DynuHttp.Http")

REM Invoke the URL
myhttp.URL = "http://www.dynu.com/"

REM set the Data to be sent along with a POST request.  Parameters should be delineated by a &, as in the example.
 'myhttp.QueryString = ""

REM Set the host name and port of the proxy server.
 'myhttp.ProxyHost = ""
 'myhttp.ProxyPort = ""
 
REM Set the ProxyPassword
REM The Username and password should be separated by a :, as in below
 'myhttp.ProxyPassword = ""
 
REM Invoke the SetAuthorization method by passing the Authorization parameter in the username:passowrd format
 'myhttp.SetAuthorization("")

REM sets the HTTP header.  You can set cookies and MIME type.
 'myhttp.SetHeader("")

REM invoke the GetURL method which returns a string containing the result of the request.
HTTPResponse = myhttp.GetURL()

REM invoke the GetHeaders method which returns all the HTTP headers sent by the remote server after an HTTP request has been made to it.  Returns a two-dimensional array of strings.
HTTPHeaders = myhttp.GetHeaders()
      
Response.Write HTTPResponse
Set myhttp = nothing
0
 
SGCAuthor Commented:
Thanks all for jumping on this so quickly. Let me clarify what it is i need, though.

A page I would be hosting would serve as a template with my header, footer, branding, etc. But, the content for my page is hosted remotely on another server under another domain.

So, what I would do in tcl to display that content:

<%
set c [ ns_httpget http://www.experts-exchange.com ]
ns_puts $c
%>

Where $c is the content of the ee homepage, written now into my page and displayed for the viewer as if the content existed in the page physically.

Let me know if anymore clarification is in order.
0
 
SGCAuthor Commented:
Sorry nozlab, not what i was looking for, but thanks for the input.
0
 
nozlabCommented:
Excuse me makerp, I wasn't born infront of a computer.

Remember, there is life after computers!!!

Oh by the way, check your spelling.
0
 
SGCAuthor Commented:
Sorry nozlab, not what i was looking for, but thanks for the input.
0
 
SGCAuthor Commented:
oops, sorry for the double post.
0
 
fallon12345Commented:
An example of this that I have done in CF, is at www.hoboken.com

The weather stuff is borrowed from the weather channel, but it looks like it is my own content.  I can easily do it in CF, but have no idea how to do it in ASP.

The news and stock quotes are also borrowed.
0
 
makerpCommented:
the component i have given the URL for will do exactly this. i have just downloaded it.. its fine

also i have provided a demo of the usage.

Hope this helps

Oh

nozlab.. a little un-called for i think.
0
 
SGCAuthor Commented:
oops, sorry for the double post.
0
 
SGCAuthor Commented:
thanks makerp, i'm using it now. the points are yours. Thanks to everyone else in the thread as well.

I've got to remember to stop reloading this page after adding a comment :)
0
 
fallon12345Commented:
I'll check it out makerp, I hope it works, because it is a very useful technology.

Cheers.
0
 
makerpCommented:
coooolll good luck
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 6
  • 6
  • 3
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now