本文整理匯總了PHP中HttpRequest::exec方法的典型用法代碼示例。如果您正苦於以下問題:PHP HttpRequest::exec方法的具體用法?PHP HttpRequest::exec怎麽用?PHP HttpRequest::exec使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類HttpRequest
的用法示例。
在下文中一共展示了HttpRequest::exec方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: fromUrl
public function fromUrl($url)
{
$this->url = $url;
// ブログによっては403ではじかれる。ユーザーエージェント?IP?
$httpRequest = new HttpRequest($this->url);
$httpRequest->exec();
$this->fromText($url, $httpRequest->getResponse());
}
示例2: test
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);
}
示例3: t_estXpathSetup
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());
}
}