V
V
Vadim9972014-10-19 13:26:52
PHP
Vadim997, 2014-10-19 13:26:52

How to parse more than 200 xml files?

It is necessary to parse more than 30 xml files. Using the code below does not work, the error "failed to open stream: HTTP request failed!"
Here is the code:

for($i=16000000; $i <= 16000250; $i++) {
        $xml = simplexml_load_file("http://site/?id=$i");
        if($xml->error == "0") {
            echo $xml->people. "<br>";
        }
    }

Answer the question

In order to leave comments, you need to log in

2 answer(s)
X
xmoonlight, 2014-10-19
@xmoonlight

sleep(5) at least....
and isn't it easier with curl?

A
Alexander Zelenin, 2014-10-19
@zelenin

use guzzle, exception handling, sleep and console script, not web.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question