Solved

HTTP_GET with asp

Posted on 2000-04-25
19
273 Views
Last Modified: 2012-08-14
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
Comment
Question by:SGC
  • 6
  • 6
  • 3
  • +2
19 Comments
 
LVL 1

Expert Comment

by:fallon12345
ID: 2748024
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
 

Expert Comment

by:RafalUSA
ID: 2748039
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
 
LVL 10

Expert Comment

by:makerp
ID: 2748045
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
 

Expert Comment

by:RafalUSA
ID: 2748046
Ops, i just realized this won't help :)
0
 
LVL 10

Expert Comment

by:makerp
ID: 2748052
eemmmmm,,

RafalUSA...... pardon :)

i think you are reading a different Q
0
 

Expert Comment

by:nozlab
ID: 2748061
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
 
LVL 10

Expert Comment

by:makerp
ID: 2748076
nozlab,,,,

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

:)

have you read the question and the history ?
0
 
LVL 10

Expert Comment

by:makerp
ID: 2748091
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
 
LVL 2

Author Comment

by:SGC
ID: 2748100
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 2

Author Comment

by:SGC
ID: 2748105
Sorry nozlab, not what i was looking for, but thanks for the input.
0
 

Expert Comment

by:nozlab
ID: 2748109
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
 
LVL 2

Author Comment

by:SGC
ID: 2748116
Sorry nozlab, not what i was looking for, but thanks for the input.
0
 
LVL 2

Author Comment

by:SGC
ID: 2748121
oops, sorry for the double post.
0
 
LVL 1

Expert Comment

by:fallon12345
ID: 2748138
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
 
LVL 10

Expert Comment

by:makerp
ID: 2748143
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
 
LVL 2

Author Comment

by:SGC
ID: 2748156
oops, sorry for the double post.
0
 
LVL 2

Author Comment

by:SGC
ID: 2748164
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
 
LVL 1

Expert Comment

by:fallon12345
ID: 2748178
I'll check it out makerp, I hope it works, because it is a very useful technology.

Cheers.
0
 
LVL 10

Accepted Solution

by:
makerp earned 350 total points
ID: 2748195
coooolll good luck
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Round to 2 decimal places 2 40
C# onclick function to call another form with parameter 10 54
Out the count variables 6 53
CDO.Message not able to send attachement 5 14
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now