Answer the question
In order to leave comments, you need to log in
How to speed up parsing with phpQuery?
require_once('../phpQuery/phpQuery.php');
require_once('../curl.php');
$curl = new Curl();
$links = array(
"http://www.binance.com/ru/trade/ZEC_BTC",
"http://www.binance.com/ru/trade/ETH_BTC",
"http://www.binance.com/ru/trade/DASH_BTC",
"http://www.binance.com/en/trade/BCHABC_BTC",
"http://www.binance.com/en/trade/ETC_BTC",
"http://www.binance.com/en/trade/XRP_BTC",
"http://www.binance.com/en/trade/DOGE_BTC"
);
$curr = array(
"ZEC_BTC",
"ETH_BTC",
"DASH_BTC",
"BCHABC_BTC",
"ETC_BTC",
"XRP_BTC",
"DOGE_BTC"
);
for( $i = 0; $i < count($links); $i++){
$res = $curl->get($links[$i]);
$doc = phpQuery::newDocument($res->body);
$block = $doc->find('div.sc-62mpio-0.sc-1yysggs-2.kEGjPf');
$block = str_replace("–","", $block);
echo "<tr>";
echo "<td>".$curr[$i]."</td>";
echo "<td>".$block."</td>";
echo "</tr>";
}
Answer the question
In order to leave comments, you need to log in
It is likely that the bottleneck here is curl requests, try the answers from this stackoverflow thread
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question