That way you can strip out the bits you don't need and use the information you want. Yes, I know that's what XML is for, but the site doesn't use it yet.
I managed to get another file to work on the same server (but with a different url) but when I try the .asp address, it just says "Unable to open file". I've tried stripping down the url, and the first part works! It's the bit after the .asp that causes an error. (And yes, I've even tried urlencoding just that part of the address!)
It looks like this:
[www....] ... .co.uk/filename.asp?page=VIEW&id=4&mode=edit
I've also tried replacing the & with & amp; but no luck.
Are asp files designed to stop external sites using them?
I guess it's just not possible.
<%
Function GetHTML(strPage)
On Error Resume Next
Set objXMLHttp = Server.CreateObject ("Microsoft.XMLHTTP")
objXMLHttp.Open "GET", strPage ,False,"",""
objXMLHttp.Send
If Err.Number = 0 Then
If objXMLHttp.Status = 200 then
GetHTML = objXMLHttp.ResponseText
Else
GetHTML = "Incorrect URL"
End if
Else
GetHTML = Err.Description
End If
Set objXMLHttp = Nothing
End Function
%>
Call your funtion:
<% myPreParsedFile = GetHTML(http://www.foo.com/filename.asp) %>
Now your "myPreParsedFile" variable contains all the HTML of the remote file. You can display it with <% =myPreParsedFile %> or you can write your parsing routine, then display it afterwards.
G.
Officially I've given up. But many times I've done that, and gone back to a script for one last go, and made it work.
Catch you later.
Edit: I looked at the 2 XML scripts I have and both use fopen as normal. So my scripts will never work. At least not with the server I need to parse files from.
I am wondering if it is a timing problem with the asp file. Sometimes when surfing the site normally, the page doesn't come up, but the home page instead. The site owners inform me this is a bug they are fixing. So maybe their server doesn't 'create' the file in time for my PHP request to grab it? Only it works without the variables in the URL (ie: grabbing just the template file).
I believe the problem with your fOpen is that that routine tries to open the file as it is, whereas my routine will actually execute the file and slap the results into your variable. Yours would work fine on a static page, but it's not going to ever work where the server needs to process something. (At least that's the way I imagine it).
The KEY is in these lines:
Set objXMLHttp = Server.CreateObject ("Microsoft.XMLHTTP")
objXMLHttp.Open "GET", strPage ,False,"",""
objXMLHttp.Send
GetHTML = objXMLHttp.ResponseText
The rest is just error checking stuff to keep it all clean.
G.