require_once './vendor/autoload.php';
$client = new \Goutte\Client();
$guzzleClient = new \GuzzleHttp\Client(array(
'curl' => array(
CURLOPT_TIMEOUT => 60,
),
));
$client->setClient($guzzleClient);
$client->get('http://reactone-loc.ru', [
'query' => ['get' => 'params'],
'on_stats' => function (TransferStats $stats) use (&$url) {
$url = $stats->getEffectiveUri();
}
])->getBody()->getContents();
echo $url;
<b>Fatal error</b>: Uncaught Error: Call to undefined method Symfony\Component\DomCrawler\Crawler::getBody() in /opt/lampp/htdocs/coin/crawler/guote/index3.php:41
var_dump($crawler);
$crawler->getBody()
<b>Fatal error</b>: Uncaught Error: Call to undefined method Symfony\Component\DomCrawler\Crawler::getBody() in /opt/lampp/htdocs/coin/crawler/guote/index3.php:35
object(Symfony\Component\DomCrawler\Crawler)#33 (7) {
["uri":protected]=>
string(30) "http://httpbin.org/stream/1024"
["defaultNamespacePrefix":"Symfony\Component\DomCrawler\Crawler":private]=>
string(7) "default"
["namespaces":"Symfony\Component\DomCrawler\Crawler":private]=>
array(0) {
}
["baseHref":"Symfony\Component\DomCrawler\Crawler":private]=>
string(30) "http://httpbin.org/stream/1024"
["document":"Symfony\Component\DomCrawler\Crawler":private]=>
NULL
["nodes":"Symfony\Component\DomCrawler\Crawler":private]=>
array(0) {
}
["isHtml":"Symfony\Component\DomCrawler\Crawler":private]=>
bool(true)
}
threading
могу использовать Pool
вместе с map
?????