1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?php
- abstract class LRDDMethod
- {
- protected $xrd = null;
- public function __construct() {
- $this->xrd = new XML_XRD();
- }
-
- abstract public function discover($uri);
- protected function fetchUrl($url, $method=HTTPClient::METHOD_GET)
- {
-
- Event::handle('UrlBlacklistTest', array($url));
- $client = new HTTPClient();
-
- switch ($method) {
- case HTTPClient::METHOD_GET:
- $response = $client->get($url);
- break;
- case HTTPClient::METHOD_HEAD:
- $response = $client->head($url);
- break;
- default:
- throw new Exception('Bad HTTP method.');
- }
- if ($response->getStatus() != 200) {
- throw new Exception('Unexpected HTTP status code.');
- }
- return $response;
- }
- }
|