Welcome to WebmasterWorld Guest from 3.227.3.146

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Remote XML File transfer to Webserver not completing

Transferred File size stuck to 113.34MB

     
3:29 pm on May 3, 2016 (gmt 0)

Junior Member

10+ Year Member

joined:June 15, 2006
posts: 64
votes: 0


Hello,
I am trying to transfer XML feed from a remote server to my webserver (VPS). I have tried to use file_put_contents() as well as fwrite(). The process starts but finally the file that is trasnferred to my server (myfeed.xml) is stuck to 113.34MB. I have tried this on different feeds too and all the feeds just transfers 113.34MB.

When I download the feeds directly to my local machine, all are nearly 800MB and above.

Why is the full XML feed not being transferred to my webserver.

I have even changes the following PHP Values in .htaccess file:
php_value max_execution_time 900
php_value memory_limit 500M

Please guide.

//PHP Codes used for fwrite() is below:
function chunked_copy($from, $to) {
# 1 meg at a time, you can adjust this.
$buffer_size = 1024;
$ret = 0;
$fin = fopen($from, "rb");
$fout = fopen($to, "w");
while(!feof($fin)) {
$ret += fwrite($fout, fread($fin, $buffer_size));
}
fclose($fin);
fclose($fout);
return $ret;
}
$from="http://feeds.abc.com/GetFeed/?Format=xml";
$to="myfeed.xml";
chunked_copy($from, $to);


//PHP Codes used for file_put_contents() is below:
file_put_contents("myfeed.xml", fopen("http://feeds.abc.com/GetFeed/?Format=xml", 'r'));
2:23 pm on May 4, 2016 (gmt 0)

Junior Member

10+ Year Member

joined:June 15, 2006
posts: 64
votes: 0


Experts please guide
2:19 pm on May 25, 2016 (gmt 0)

Administrator

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 31, 2003
posts:12555
votes: 3


all are nearly 800MB and above

... and yet you are only setting ...
php_value memory_limit 500M


Maybe you need to hike that up a bit higher? It may also be a time limit thing ...
[php.net...]