php中如何将远程的xml文件输出到IE浏览器?!急救
因为直接用javascript读取远程xml数据,会出现权限不足,必须手动修改IE的安全设置才行.所以一般都会用asp脚本在服务器上作中转.在asp中下面函数可以实现
<%
Response.ContentType = "text/xml"
Function getUrl(Path)
t = GetAll(Path)
getUrl=BytesChangeToBstr(t,"GB2312")
End function
Function GetAll(url)
on error resume next
Set Retrieval = CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "Get", url, False, "", ""
.Send
If (.readyState=4) Then
GetAll= .ResponseBody
else
exit function
End if
End With
Set Retrieval = Nothing
End Function
Function BytesChangeToBstr(body,Cset)
On Error Resume Next
dim objstream
set objstream = Server.CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesChangeToBstr= objstream.ReadText
objstream.Close
set objstream = nothing
End Function
url="http://xxxxxxxxx/data.xml"
Response.Write getUrl(url2)
%>
请问在php中如何实现上面的功能?!!!!
急救啊!~~~~各位高手请出手相救,就算不懂的,就指点一下也行