I have got a huge xml file (~ 85 Mo) and I would like to open it with XML Reader (then my script read selected lines). I have downloaded it on my PC and my script works (using Wamp).
Now I would like to do the same online. Server login is aaa and password is bbb (of course it's an example).
I tried the following statement:
$xml = new XMLReader();
if ($xml->open('ftp://aaa:bbb@ftp.website.com/myfile.xml')){
echo 'OK';
}
while($xml->read()){
// my script here...
}
It seems I am wrong because my web browser indicates me that the page is too long to load. What is the good way to proceed? Or did I miss something important?
Since the file in question is an XML it is not wise to partially download it since it will probably break the xml structure making the parser to fail.
You could get a cronjob to retrieve the file occasionally and you would open it from a local location on the server, or retrieve it once and cache it locally so that it would speed subsequent requests.