public function fromUrl($url) { $this->url = $url; // ブログによっては403ではじかれる。ユーザーエージェント?IP? $httpRequest = new HttpRequest($this->url); $httpRequest->exec(); $this->fromText($url, $httpRequest->getResponse()); }
public function test() { $httpRequest = new HttpRequest(self::URL_UTF8); $ret = $httpRequest->exec(); $this->assertEquals($ret, true); $httpRequest = new HttpRequest(self::URL_EUC_JP); $ret = $httpRequest->exec(); $this->assertEquals($ret, true); }
public function t_estXpathSetup() { return; $datPath = implode('/', [PATH_TEST, 'dat', 'ContentExtractor']); // $res = exec(sprintf('rm -rf %s/*', $datPath), $out); foreach ($this->getData() as $name => $testData) { $httpRequest = new HttpRequest($testData->url); $ret = $httpRequest->exec(); if (!$ret) { d($httpRequest->getError()); d($httpRequest->getInfo()); } $this->assertEquals(true, $ret); file_put_contents($datPath . '/' . $name, $httpRequest->getResponse()); } }