Jump to content


xml import accoss domains

  • Please log in to reply
No replies to this topic

#1 FatRod

  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 27 October 2006 - 09:28 AM


New to PHP.

I have a xml output [http://mydomain.com/xml.php?number=10] on another domian that i need to display on my site. js wont work due to security reasons so i need to use a Server side proxy i belive.

I asked for some help and got this back but cant get it to work.

So. instead of calling http://mydomain.com/xml.php?number=10

I call http://yourdomain.com/xmlFile.php

xmlFile.php then contains the follwing

$strXmlData = fetchRemoteURL ( "http://yourdomain.com/xmlFile.php" ); //preferably using curl, though a simple fopen, fread() loop might do
header ( "content-type: text/xml" );
print $strXmlData;


function fetchRemoteURL ( $strURL ) 
 $strResult = '';
 $fh = fopen ( $strURL, "rb");
  if ( $fh ) 
     while ( !feof ( $fh ) ) 
       $strResult .= fread ( $fh, 8192 ) ;
 return $strResult;

can anyone help or surgest a better alternitive. the xml feed is not RSS complient BTW.



0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users