Solved

HTTP_GET with asp

Posted on 2000-04-25
19
272 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Ops, i just realized this won't help :)
0
 
LVL 10

Expert Comment

by:makerp
Comment Utility
eemmmmm,,

RafalUSA...... pardon :)

i think you are reading a different Q
0
 

Expert Comment

by:nozlab
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 2

Author Comment

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

Expert Comment

by:nozlab
Comment Utility
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
Comment Utility
Sorry nozlab, not what i was looking for, but thanks for the input.
0
 
LVL 2

Author Comment

by:SGC
Comment Utility
oops, sorry for the double post.
0
 
LVL 1

Expert Comment

by:fallon12345
Comment Utility
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
Comment Utility
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
Comment Utility
oops, sorry for the double post.
0
 
LVL 2

Author Comment

by:SGC
Comment Utility
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
Comment Utility
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
Comment Utility
coooolll good luck
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 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

9 Experts available now in Live!

Get 1:1 Help Now