示例#1
0
 /**
  * @inheritdoc
  */
 public function readLink(LinkInterface $link)
 {
     $client = $this->getClient();
     try {
         $response = $client->request('GET', $link->getUrl(), array_merge($this->config, ['on_stats' => function (TransferStats $stats) use(&$link) {
             $link->setEffectiveUrl($stats->getEffectiveUri());
         }]));
         $link->setContent($response->getBody())->setContentType($response->getHeader('Content-Type')[0]);
     } catch (ConnectException $e) {
         $link->setContent(false)->setContentType(false);
     }
     return $link;
 }