本文整理汇总了PHP中HttpRequest::addCookies方法的典型用法代码示例。如果您正苦于以下问题:PHP HttpRequest::addCookies方法的具体用法?PHP HttpRequest::addCookies怎么用?PHP HttpRequest::addCookies使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HttpRequest
的用法示例。
在下文中一共展示了HttpRequest::addCookies方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: HttpRequest
<?php
$r = new HttpRequest();
$r->addCookies(array("cookie_name" => "cookie value"));
示例2: reddit_POST
function reddit_POST($subreddit, $to, $data)
{
global $REDDIT, $modhash, $cookies;
$data['uh'] = $modhash;
$data['api_type'] = 'json';
if ($subreddit) {
$data['r'] = $subreddit;
}
$request = new HttpRequest("{$REDDIT}/{$to}.json", HttpRequest::METH_POST);
$request->addCookies($cookies);
$request->addPostFields($data);
$response = $request->send();
$status = $response->getResponseCode();
if ($status != 200) {
die("/{$to} failed, status={$status}\n");
}
return $response;
}
示例3: test_HttpRequest
/**
* Test HttpRequest.
*/
function test_HttpRequest()
{
$http = new HttpRequest();
$http->addCookies(array("cookie_name" => "cookie value"));
}
示例4: getRequest
/**
* @return \HttpRequest
*/
protected function getRequest()
{
$result = new \HttpRequest();
$result->addCookies(array('PHPUNIT_SELENIUM_TEST_ID' => $this->testId));
return $result;
}