本文整理汇总了PHP中SimpleUrl::addRequestParameters方法的典型用法代码示例。如果您正苦于以下问题:PHP SimpleUrl::addRequestParameters方法的具体用法?PHP SimpleUrl::addRequestParameters怎么用?PHP SimpleUrl::addRequestParameters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleUrl
的用法示例。
在下文中一共展示了SimpleUrl::addRequestParameters方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SimpleUrl
function testGetRequestWithoutIncidentGivesNoErrors()
{
$url = new SimpleUrl('http://test:secret@this.com/page.html');
$url->addRequestParameters(array('a' => 'A', 'b' => 'B'));
$agent =& new MockRequestUserAgent();
$agent->setReturnReference('_createHttpRequest', $this->_request);
$agent->SimpleUserAgent();
$response =& $agent->fetchResponse(new SimpleUrl('http://test:secret@this.com/page.html'), new SimpleGetEncoding(array('a' => 'A', 'b' => 'B')));
$this->assertFalse($response->isError());
}
示例2: createAbsoluteUrl
/**
* Turns an incoming URL string into a
* URL object, filling the relative URL if
* a base URL is present.
* @param string $base_url Browser current URL.
* @param string $raw_url Incoming URL.
* @param hash $parameters Additional request, parameters.
* @return SimpleUrl Absolute URL.
* @access public
* @static
*/
function createAbsoluteUrl($base_url, $raw_url, $parameters = false)
{
$url = new SimpleUrl($raw_url);
if ($parameters) {
$url->addRequestParameters($parameters);
}
$url->makeAbsolute($base_url);
return $url;
}
示例3: testHead
function testHead()
{
$headers =& new MockSimpleHttpHeaders($this);
$headers->setReturnValue('getMimeType', 'text/html');
$headers->setReturnValue('getResponseCode', 200);
$headers->setReturnValue('getNewCookies', array());
$response =& new MockSimpleHttpResponse($this);
$response->setReturnValue('getContent', 'stuff');
$response->setReturnReference('getHeaders', $headers);
$request =& new MockSimpleHttpRequest($this);
$request->setReturnReference('fetch', $response);
$url = new SimpleUrl('http://this.com/page.html');
$url->addRequestParameters(array('a' => 'A', 'b' => 'B'));
$agent =& new MockRequestUserAgent($this);
$agent->setReturnReference('_createHttpRequest', $request);
$agent->expectOnce('_createHttpRequest', array('HEAD', new SimpleUrl('http://test:secret@this.com/page.html?a=A&b=B'), array()));
$agent->SimpleUserAgent();
$agent->fetchResponse('HEAD', new SimpleUrl('http://test:secret@this.com/page.html'), array('a' => 'A', 'b' => 'B'));
$agent->tally();
}
示例4: SimpleHttpPostRequest
/**
* Builds the appropriate HTTP request object.
* @param string $method Fetching method.
* @param SimpleUrl $url Target to fetch as url object.
* @param hash $parameters POST/GET parameters.
* @return SimpleHttpRequest New request object.
* @access protected
*/
function &_createHttpRequest($method, $url, $parameters)
{
if ($method == 'POST') {
$request =& new SimpleHttpPostRequest($url, $parameters);
return $request;
}
if ($parameters) {
$url->addRequestParameters($parameters);
}
return new SimpleHttpRequest($url, $method);
}
示例5: MockSimpleHttpHeaders
function _testHead()
{
$headers =& new MockSimpleHttpHeaders($this);
$headers->setReturnValue('getMimeType', 'text/html');
$headers->setReturnValue('getResponseCode', 200);
$headers->setReturnValue('getNewCookies', array());
$response =& new MockSimpleHttpResponse($this);
$response->setReturnValue("getContent", "stuff");
$request =& new MockSimpleHttpRequest($this);
$request->setReturnReference('fetch', $response);
$url = new SimpleUrl("http://this.com/page.html");
$url->addRequestParameters(array("a" => "A", "b" => "B"));
$agent =& new MockRequestUserAgent($this);
$agent->setReturnReference('_createRequest', $request);
$agent->expectOnce('_createRequest', array('HEAD', $url, array("a" => "A", "b" => "B")));
$agent->SimpleUserAgent();
$agent->fetchResponse('HEAD', 'http://this.com/page.html', array("a" => "A", "b" => "B"));
$agent->tally();
}
示例6: testHead
function testHead()
{
$headers =& new MockSimpleHttpHeaders($this);
$headers->setReturnValue('getMimeType', 'text/html');
$headers->setReturnValue('getResponseCode', 200);
$headers->setReturnValue('getNewCookies', array());
$response =& new MockSimpleHttpResponse($this);
$response->setReturnValue('getContent', 'stuff');
$response->setReturnReference('getHeaders', $headers);
$request =& new MockSimpleHttpRequest($this);
$request->setReturnReference('fetch', $response);
$url = new SimpleUrl('http://this.com/page.html');
$url->addRequestParameters(array('a' => 'A', 'b' => 'B'));
$agent =& new MockRequestUserAgent($this);
$agent->setReturnReference('_createHttpRequest', $request);
$agent->SimpleUserAgent();
$agent->fetchResponse('HEAD', 'http://this.com/page.html', array('a' => 'A', 'b' => 'B'));
$this->assertIdentical($agent->getCurrentUrl(), false);
$this->assertIdentical($agent->getCurrentMethod(), false);
$this->assertEqual($agent->getCurrentPostData(), false);
$agent->tally();
}