Jump to content

xml import accoss domains


FatRod

Recommended Posts

Hi.

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

[code]$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;[/code]

and

[code]function fetchRemoteURL ( $strURL )
{
$strResult = '';
$fh = fopen ( $strURL, "rb");
  if ( $fh )
  {
    while ( !feof ( $fh ) )
      $strResult .= fread ( $fh, 8192 ) ;
  }
return $strResult;
[/code]

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

Cheers

FR
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.