X-Git-Url: https://git.cweiske.de/stapibas.git/blobdiff_plain/06e27411941eb4dc1eb77688d710b048a95be7b1..facbe390acb49ffa8ab225e8b4c382759fa0302d:/src/stapibas/Feed/PingUrls.php diff --git a/src/stapibas/Feed/PingUrls.php b/src/stapibas/Feed/PingUrls.php index 1e98f0a..926dd8c 100644 --- a/src/stapibas/Feed/PingUrls.php +++ b/src/stapibas/Feed/PingUrls.php @@ -16,16 +16,18 @@ class Feed_PingUrls $this->db = $deps->db; $this->log = $deps->log; - $this->pbc = new \PEAR2\Services\Pingback\Client(); - - $req = new \HTTP_Request2(); + $this->pbc = new \PEAR2\Services\Linkback\Client(); + $req = $this->pbc->getRequest(); $req->setConfig( array( 'ssl_verify_peer' => false, 'ssl_verify_host' => false ) ); - $this->pbc->setRequest($req); + $this->pbc->setRequestTemplate($req); + $headers = $req->getHeaders(); + $req->setHeader('user-agent', 'stapibas / ' . $headers['user-agent']); + $this->pbc->setDebug(true); } @@ -61,7 +63,8 @@ class Feed_PingUrls $this->log->info('Pinging %d URLs..', count($options)); $res = $this->db->query( - 'SELECT fe_url, feu_id, feu_url FROM feedentries, feedentryurls' + 'SELECT fe_url, feu_id, feu_url, feu_tries' + . ' FROM feedentries, feedentryurls' . ' WHERE fe_id = feu_fe_id' . $this->sqlNeedsUpdate() . ' AND (' . implode(' OR ', $options) . ')' @@ -116,14 +119,17 @@ class Feed_PingUrls ); } else { //error - $this->log->err('Error: ' . $res->getCode() . ': ' . $res->getMessage()); + $code = $res->getCode(); + $this->log->err('Error: ' . $code . ': ' . $res->getMessage()); $httpRes = $res->getResponse(); if ($httpRes) { $this->log->info( 'Pingback response: Status code ' . $httpRes->getStatus() . ', headers: ' . print_r($httpRes->getHeader(), true) ); - //. ', body: ' .$httpRes->getBody() + if ($code == 100 || $code == 101 || $code == -32600) { + $this->log->info('HTTP body: ' . $httpRes->getBody()); + } } $this->db->exec( 'UPDATE feedentryurls SET'