Save remote XML to local website folder


Posted on 16th Feb 2014 07:03 pm by admin

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

No comments posted yet

Your Answer:

Login to answer
316 Like 22 Dislike
Previous forums Next forums
Other forums

PHP referral database. I would like this form to email the referrer.
Okay, Hello I've been trolling for years. This the first time I've ever asked for php help. Normally

Javascript form submit and radio buttons?
When this form is submitted, it is automatically resubmitted using JS.

All my fields are carr

passthru() help
Hi everyone,
I'm new to the forum and to PHP. I have some pretty good experience writing shell sc

Snapshot from video
anyone knw how to make a snapshot maker from avi n mkv format.
for example if i give a direct lin

XML Grouping
I'm using xml_parse_into_struct to get all my elements, but now I need to group them. For example, h

why preg_match_all does not return the number of matches
My regex looks like

X[^x{4e00}-x{9fa5}]*Y

(where X and Y are two Chinese characters)

problem when runing a funciton
I am trying to connect to database using a funciton in a functions.php

<?php
funct

Need help urgant
why down my code ony return one item instead of all the items selected.

$arr = array($date,$

cURL proxy
Okay here is the thing... i know how to add proxys

Code: curl_setopt($ch, CURLOPT_PROXYTYPE,

Page Reload
I am having issues getting a page to reload after I submit data to a database. This form should inp

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash