target = $target; if (!isset($client)) { throw new Exception('No available http client', 50); } try { $client->setTimeout(5) ->send($url); } catch (HttpException $e) { throw new Exception('Pingback http error', 50); } if ($client->getResponseStatus() != 200) { throw new Exception('Pingback wrong http status', 50); } $response = $client->getResponseBody(); $encoding = 'UTF-8'; $contentType = $client->getResponseHeader('Content-Type'); if (!empty($contentType) && preg_match("/charset=([_a-z0-9-]+)/i", $contentType, $matches)) { $encoding = strtoupper($matches[1]); } elseif (preg_match("/html = $encoding == 'UTF-8' ? $response : mb_convert_encoding($response, 'UTF-8', $encoding); if ( !$client->getResponseHeader('X-Pingback') && !preg_match_all("/]*rel=[\"']pingback[\"'][^>]+href=[\"']([^\"']*)[\"'][^>]*>/i", $this->html) ) { throw new Exception("Source server doesn't support pingback", 50); } } /** * get title * * @return string */ public function getTitle(): string { if (preg_match("/\