Jump to content

Save remote XML to local website folder


harvlake

Recommended Posts

Hi, I hope you can help me out.  I would like to be able to pull an XML file from another site and then store it in a local folder on my site.  That way, I would only need to pull the xml file once in a while instead of every time someone opens that page.

 

here is a snippet of code I found, but the size of the saved XML file is smaller and is not consistently the same size of file.  Some of the information gets lost.

 

$fp = fopen( 'http://forecast.weather.gov/MapClick.php?lat=45.21640&lon=-112.63700&FcstType=dwml', 'r' );

$string = fread( $fp, 1024*9 );

fclose( $fp ); 

 

$fp = fopen( 'weather.xml', 'w' );

fwrite( $fp, $string );

fclose( $fp );

 

I hope I explained that

Link to comment
https://forums.phpfreaks.com/topic/183278-save-remote-xml-to-local-website-folder/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.