Topic: XML imports accross domain (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=28336" title="Pages that link to Topic: XML imports accross domain (Page 1 of 1)" rel="nofollow" >Topic: XML imports accross domain <span class="small">(Page 1 of 1)</span>\

 
FatRod
Bipolar (III) Inmate

From: #UK SURREY
Insane since: May 2002

IP logged posted posted 08-17-2006 13:05 Edit Quote

I have an external xml file on another domain which i need to import and pass. All the JS solutions i have looked at including AJAX do not seem to work - i belive this to be a security feature with JS imports where the file has to be on the same domain.

Is there an easy solution?

Cheers

Ben

poi
Paranoid (IV) Inmate

From: Norway
Insane since: Jun 2002

IP logged posted posted 08-17-2006 13:33 Edit Quote

Yep for security reasons cross site request are not allowed.
However you can bypass that using a server side script as a proxy ... at the cost of higher latency and more bandwidth usage.

FatRod
Bipolar (III) Inmate

From: #UK SURREY
Insane since: May 2002

IP logged posted posted 08-17-2006 14:55 Edit Quote

i wish i knew what a server side script as a proxy was!

after a biot of googling it seems there are no simple cut 'n' paste scripts out there, that i can find at least

any idea's? maybe something that includes an XML Passer

Ben

Ben Corke | IT Recruitment Consultant | ben@cerebra.co.uk | www.cerebra.co.uk

Tyberius Prime
Maniac (V) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

IP logged posted posted 08-17-2006 17:02 Edit Quote

Server side proxy

You call instead of
http://otherdomain.com/xmlFile

http://yourdomain.com/xmlFile.php

xmlFile.php then contains the follwing

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



so long,

->Tyberius Prime

FatRod
Bipolar (III) Inmate

From: #UK SURREY
Insane since: May 2002

IP logged posted posted 10-24-2006 19:31 Edit Quote

OK, following TP's post, I created a php file and included the script above (simply swapping the url with mine) and it did not work - then guessing TP's reference //preferably using CURL I assumed that TP wants me to learn some PHP.... i tried again without much success...


Then I though that I could use some sort of RSS parser script or XML scroller but the output is not RSS compliant and the content is on another domain.

I wish to grab the output of a url like http://otherdomain/xml.php?number=20 and display it within a html page on my domain - surely this should be simple!

can anyone help? please!

Cheers

Tyberius Prime
Maniac (V) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

IP logged posted posted 10-24-2006 19:36 Edit Quote

Uh, of course fetchRemoteURL needs to be coded by you .

here's a very simple implementation, it might be enough, or it might not.

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

}



But of course it's not tested or anything.

So long,

->Tyberius Prime

FatRod
Bipolar (III) Inmate

From: #UK SURREY
Insane since: May 2002

IP logged posted posted 11-14-2006 13:38 Edit Quote

I need to learn some PHP me thinks

Ben Corke | IT Recruitment Consultant | ben@cerebra.co.uk | www.cerebra.co.uk

Steve
Maniac (V) Inmate

From: Boston, MA, USA
Insane since: Apr 2000

IP logged posted posted 11-14-2006 20:46 Edit Quote

I have an example of a proxy script that uses cURL as part of a tutorial on making an RSS reader using Flash (Flash has pretty tight sandbox rules too). I had to use cURL because DreamHost stopped supporting readfile(). You might be able to make some use of it:

http://www.thegoldenmean.com/technique/rssReader12.html



Post Reply
 
Your User Name:
Your Password:
Login Options: Remember Me On This Computer
 
Your Text:
Loading...
Options: Show Signature
Enable Slimies
Enable Linkwords

« BackwardsOnwards »

Show Forum Drop Down Menu