Author |
Topic |
|
mafifi
Junior Member
USA
308 Posts |
Posted - 02 August 2001 : 19:31:37
|
OK folks. The following is a ColdFusion Code that pulls information from one page and posts it into another. How can you do that in ASP? Please do not get confused with CF stuff in the code. It stands for ColdFusion
quote:
<html> <head> <title>xxxxxxxxxxxxxxx</title>
<table border="0"> <tr> <td> <CFHTTP URL="http://www.your_site.com/sample/default.html" METHOD="GET"> </CFHTTP> <CFSET Count=FindNoCase("</font>",CFHTTP.FILECONTENT)+7> <CFSET Count2=FindNoCase("</body>",CFHTTP.FILECONTENT)> <CFSET COUNT2 = count2-count> <CFSET Page=Mid(CFHTTP.FILECONTENT, count, COUNT2)> <CFOUTPUT> #Page# </CFOUTPUT>
Thanks,
Mo |
|
mafifi
Junior Member
USA
308 Posts |
Posted - 06 August 2001 : 20:22:03
|
Here is what it means. Is there any similar code in ASP.
quote: The first cfset <cfset count= Looks for the first instance of the tag </font> in the html of the file you got. Then it returns the position value of that tag plus 7. So it finds the position directly after the first </font> tag. The second cfset <cfset count2= is the same, but it looks for the </body> tag. And finally the <cfset page= returns the number of characters between the end of the </font> tag and the </body> tag.
Thanks,
Mo |
|
|
RichardKinser
Snitz Forums Admin
USA
16655 Posts |
Posted - 06 August 2001 : 21:30:01
|
You would need to have an ASP Component such as ASPTear installed to do that. |
|
|
mrWize
deleted
119 Posts |
Posted - 07 August 2001 : 02:34:11
|
He, He ... no, You don+t need a component installed, just MS-XML
<% Set objHTTP = Server.CreateObject("Microsoft.XMLHTTP") objHTTP.Open "GET", "http://www.domain-to-get.com/", False objHTTP.Send strHTML=objHTTP.responseText Set objHTTP = Nothing %>
In the variable strHTML is the page/url you requested stored.
cya, PatrikB
Edited by - mrwize on 07 August 2001 02:34:50 |
|
|
Doug G
Support Moderator
USA
6493 Posts |
Posted - 07 August 2001 : 11:13:50
|
MSXML IS a component, and won't exist on servers without IE5+ installed.
====== Doug G ====== |
|
|
Martha2Mary
Junior Member
New Zealand
250 Posts |
Posted - 07 August 2001 : 16:34:05
|
quote:
He, He ... no, You don+t need a component installed, just MS-XML
<% Set objHTTP = Server.CreateObject("Microsoft.XMLHTTP") objHTTP.Open "GET", "http://www.domain-to-get.com/", False objHTTP.Send strHTML=objHTTP.responseText Set objHTTP = Nothing %>
In the variable strHTML is the page/url you requested stored.
This is something that I also wanted to implement on my website, but I had difficulties as the page I wanted to 'get' was one that redirected the User depending on the date, which was determined via Javascript on the 'get' page. Sooooo, I don't suppose you would know how I can modify the code above to allow for this, do you? Many thanks!
*If Knowledge is Power, and Power Corrupts, what hope is there for Mankind * |
|
|
mrWize
deleted
119 Posts |
Posted - 07 August 2001 : 17:32:38
|
No, I don´t ...
If You can get the javascript function You can also decide wich page to get.
quote:
MSXML IS a component, and won't exist on servers without IE5+ installed.
So is ASP, ADODB, SERVER, REQUEST, RESPONSE too.
What I ment is that not a third-party component has to be used
cya, PatrikB a.k.a mrwize - http://www.mrwize.nu |
|
|
mafifi
Junior Member
USA
308 Posts |
Posted - 08 August 2001 : 12:56:21
|
mrWize,
I installed IE 5.5 on my server and used your code as provided except that I put the correct URL but no results are coming back. Any ideas where I went wrong. quote: <% Set objHTTP = Server.CreateObject("Microsoft.XMLHTTP") objHTTP.Open "GET", "http://MY_SYSTEM/article1.html", False objHTTP.Send strHTML=objHTTP.responseText Set objHTTP = Nothing %>
Thanks,
Mo
Edited by - mafifi on 08 August 2001 12:56:57 |
|
|
Martha2Mary
Junior Member
New Zealand
250 Posts |
Posted - 08 August 2001 : 16:47:10
|
Try this code, which seems to work for me:
<% Response.Buffer = True Dim objXMLHTTP, xml Set xml = Server.CreateObject("Microsoft.XMLHTTP") xml.Open "GET", "http://url_to_get_here", False xml.Send Response.Write xml.responseText Set xml = Nothing %>
Hope this helps.....
*If Knowledge is Power, and Power Corrupts, what hope is there for Mankind * |
|
|
mrWize
deleted
119 Posts |
Posted - 09 August 2001 : 10:55:16
|
<% Set objHTTP = Server.CreateObject("Microsoft.XMLHTTP") objHTTP.Open "GET", "http://MY_SYSTEM/article1.html", False objHTTP.Send strHTML=objHTTP.responseText Set objHTTP = Nothing
Response.Write strHTML %>
The whole page is stored in the variable - strHTML. Just search through it, print it out or whatever You like to do whit the content.
cya, PatrikB a.k.a mrWize
|
|
|
Spoon
Average Member
Ireland
507 Posts |
Posted - 09 August 2001 : 12:04:37
|
It is possible to stream code from a file on another website.
Regards - Spoon
Begineer? Need help installing the forums? - www.aslickpage.com/snitz_help.html
www.ASlickPage.com - Private Messaging |
|
|
mafifi
Junior Member
USA
308 Posts |
Posted - 10 August 2001 : 17:51:48
|
quote: It is possible to stream code from a file on another website.
I'm not sure what you mean, could you please elaborate.
I tried the code by mrWize and Martha2Mary and it works fine, but can you return certain parts of the page and not the whole thing similar to the ColdFusion example?
Thanks,
Mo |
|
|
Martha2Mary
Junior Member
New Zealand
250 Posts |
|
mafifi
Junior Member
USA
308 Posts |
|
mafifi
Junior Member
USA
308 Posts |
|
Doug G
Support Moderator
USA
6493 Posts |
Posted - 10 August 2001 : 22:53:38
|
InetCtls.Inet is the Program ID for an ActiveX control "Microsoft Internet Transfer Control 6.0", found in the file MSInet.ocx
This control ships with Visual Basic, Visual FoxPro and Microsoft Office Developer, and is redistributable by developers.
There is no guarantee it will exist on a given web server, as far as I know the control isn't part of IIS/NT/2K.
You can find info on this control in the MSDN library at msdn.microsoft.com/library (I think this is the URL, MS recently redid their site).
====== Doug G ====== |
|
|
|
Topic |
|