当前位置: 首页>>代码示例>>PHP>>正文


PHP Net_URL2::getQueryVariables方法代码示例

本文整理汇总了PHP中Net_URL2::getQueryVariables方法的典型用法代码示例。如果您正苦于以下问题:PHP Net_URL2::getQueryVariables方法的具体用法?PHP Net_URL2::getQueryVariables怎么用?PHP Net_URL2::getQueryVariables使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Net_URL2的用法示例。


在下文中一共展示了Net_URL2::getQueryVariables方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array

}
$images = array();
for ($start = 0; $start < 200; $start += 20) {
    // echo $start . "\n";
    $html = getContents($searchURL, $start)->getBody();
    // $html = file_get_contents('images.html');
    $dom = new DOMDocument();
    @$dom->loadHTML($html);
    // grab all the on the page
    $xpath = new DOMXPath($dom);
    $hrefs = $xpath->evaluate('/html/body//div[@id="ImgCont"]//td//a');
    for ($i = 0; $i < $hrefs->length; $i++) {
        $url = $hrefs->item($i)->getAttribute('href');
        list(, $querystring) = explode('?', $url);
        $neturl = new Net_URL2("http://example.com/?{$querystring}");
        $vars = $neturl->getQueryVariables();
        if (isset($vars['imgurl'])) {
            $images[] = $vars['imgurl'];
        }
    }
}
foreach ($images as $count => $image) {
    preg_match_all('/([.][^.]+)$/', $image, $foo);
    if (!isset($foo[0][0])) {
        continue;
    }
    $ext = strtolower($foo[0][0]);
    $filename = "images/kittens/{$count}{$ext}";
    echo $filename . "\n";
    try {
        $contents = getContents($image, 0, $userAgent)->getBody();
开发者ID:shupp,项目名称:bandk,代码行数:31,代码来源:scrape.php

示例2: validateReturnToNonce

 /**
  * Validates the nonce embedded in the openid.return_to paramater and deletes 
  * it from storage.. (For use with OpenID 1.1 only)
  * 
  * @return void
  * @throws OpenID_Assertion_Exception on invalid or non-existing nonce
  */
 protected function validateReturnToNonce()
 {
     $returnTo = $this->message->get('openid.return_to');
     if ($returnTo === null) {
         // Must be a checkid_immediate negative assertion.
         $rtURL2 = new Net_URL2($this->message->get('openid.user_setup_url'));
         $rtqs = $rtURL2->getQueryVariables();
         $returnTo = $rtqs['openid.return_to'];
         $identity = $rtqs['openid.identity'];
     }
     $netURL = new Net_URL2($returnTo);
     $qs = $netURL->getQueryVariables();
     if (!array_key_exists(OpenID_Nonce::RETURN_TO_NONCE, $qs)) {
         throw new OpenID_Assertion_Exception('Missing OpenID 1.1 return_to nonce');
     }
     if (!isset($identity)) {
         $identity = $this->message->get('openid.identity');
     }
     $nonce = $qs[OpenID_Nonce::RETURN_TO_NONCE];
     $discover = $this->getDiscover($identity);
     $endPoint = $discover->services[0];
     $URIs = $endPoint->getURIs();
     $opURL = array_shift($URIs);
     $fromStore = self::getStore()->getNonce(urldecode($nonce), $opURL);
     // Observing
     $logMessage = "returnTo: {$returnTo}\n";
     $logMessage .= 'OP URIs: ' . print_r($endPoint->getURIs(), true) . "\n";
     $logMessage .= 'Nonce in storage?: ' . var_export($fromStore, true) . "\n";
     OpenID::setLastEvent(__METHOD__, $logMessage);
     if (!$fromStore) {
         throw new OpenID_Assertion_Exception('Invalid OpenID 1.1 return_to nonce in response');
     }
     self::getStore()->deleteNonce($nonce, $opURL);
 }
开发者ID:shupp,项目名称:openid,代码行数:41,代码来源:Assertion.php

示例3: getQueryVariables

 /**
  * Returns the query portion of the url in array form.
  * 
  * @return array
  */
 public function getQueryVariables()
 {
     return $this->_url->getQueryVariables();
 }
开发者ID:southworkscom,项目名称:azure-sdk-for-php,代码行数:9,代码来源:Url.php

示例4: test17036

 /**
  * This is a regression test to test that Net_URL2::getQueryVariables() does
  * not have a problem with nested array values in form of stacked brackets and
  * was reported as Bug #17036 on 2010-01-26 15:48 UTC that there would be
  * a problem with parsed query string.
  *
  * @link   https://pear.php.net/bugs/bug.php?id=17036
  * @covers Net_URL2::getQueryVariables
  * @return void
  */
 public function test17036()
 {
     $queryString = 'start=10&test[0][first][1.1][20]=coucou';
     $url = new Net_URL2('?' . $queryString);
     $vars = $url->getQueryVariables();
     $expected = array();
     $expected['start'] = '10';
     $expected['test'][0]['first']['1.1'][20] = 'coucou';
     $this->assertEquals($expected, $vars);
     // give nice diff in case of failuer
     $this->assertSame($expected, $vars);
     // strictly assert the premise
 }
开发者ID:rafalwojciechowski,项目名称:news,代码行数:23,代码来源:URL2Test.php


注:本文中的Net_URL2::getQueryVariables方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。