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


PHP Snoopy类代码示例

本文整理汇总了PHP中Snoopy的典型用法代码示例。如果您正苦于以下问题:PHP Snoopy类的具体用法?PHP Snoopy怎么用?PHP Snoopy使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: init

 private function init()
 {
     if ($this->type == 'xtu' || $this->type == 'xx') {
         $url = $this->baseUrl[$this->type] . '?TXTXH=' . $this->sid . '&TXTXM=' . urlencode(iconv("utf-8", "gbk", $this->name)) . '&TXTZH=' . $this->card . '&CmdFind=' . urlencode(iconv("utf-8", "gbk", " 查 询 "));
     } else {
         return $this->setMsg(5);
     }
     $snoopy = new Snoopy();
     $snoopy->agent = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36';
     $snoopy->referer = $this->type == 'xtu' ? $this->baseUrl['xtu'] : $this->baseUrl['xx'];
     $snoopy->rawheaders["Pragma"] = "no-cache";
     $snoopy->cookies["ASPSESSIONIDSSQCTSQS"] = 'BNIHIILBELEAJGBFGFNHGCME';
     $snoopy->fetch($url);
     if ($snoopy->status != 200) {
         return $this->setMsg(3);
     }
     $data = iconv('gbk', 'utf-8', $snoopy->results);
     if (!preg_match('/湘潭大学/', $data)) {
         return $this->setMsg(2);
     } else {
         if (preg_match('/对不起/', $data)) {
             return $this->setMsg(5);
         } else {
             if (preg_match('/班级代码/', $data)) {
                 $this->processData($data);
             } else {
                 return $this->setMsg(4);
             }
         }
     }
 }
开发者ID:andreas39,项目名称:api.sky31.com,代码行数:31,代码来源:SearchMate.class.php

示例2: get_read

function get_read($url = '', $key, $uid = 1)
{
    $wzurl = "{$url}&key={$key}&ascene=1&uin=Nzc5OTI2MTIx&pass_ticket=kzTtalLseTrEcwKVHswOVecGMByySYu94gRKdAXokFv2jg4UAOt%2FkrZHb0IwUlSB";
    $bsurl = "http://mp.weixin.qq.com/s?{$url}";
    require_once "Snoopy.class.php";
    $snoopy = new Snoopy();
    $snoopy->agent = "Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16";
    //伪装浏览器
    $snoopy->fetch($wzurl);
    //获取所有内容
    $content = $snoopy->results;
    //显示结果
    preg_match('/<span id="readNum">([^<]*)<\\/span>/si', $content, $read);
    preg_match('/var likeNum = \'([^<]*)\';/si', $content, $suport);
    // $content = htmlspecialchars($content);
    $wz['content'] = str_replace(array("'", "\""), array("\\'", "\\\""), $content);
    if ($suport[1] == "赞" || $suport[1] == '') {
        $wz['suport'] = 0;
    } else {
        $wz['suport'] = (int) $suport[1];
    }
    if ($read[1] == '') {
        $wz['read'] = 0;
    } else {
        $wz['read'] = (int) $read[1];
    }
    return $wz;
}
开发者ID:uuking,项目名称:test,代码行数:28,代码来源:update.php

示例3: doTag

 function doTag()
 {
     require_once iPATH . 'include/cn.class.php';
     require_once iPATH . 'include/snoopy.class.php';
     $title = urlencode(CN::u2g($_POST['title']));
     $Snoopy = new Snoopy();
     $Snoopy->agent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5";
     $Snoopy->accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
     $baidu = 'http://www.baidu.com/s?wd=' . $title;
     $Snoopy->fetch($baidu);
     preg_match_all("/<td\\s*nowrap\\s*class=\"f14\"><a\\s*href=\".*?\">(.*?)<\\/a><\\/td>/is", CN::g2u($Snoopy->results), $match);
     $baiduTag = (array) array_unique($match[1]);
     $google = 'http://www.google.com.hk/search?hl=zh-CN&source=hp&q=' . $title . '&aq=f&aqi=&aql=&oq=&gs_rfai=';
     $Snoopy->fetch($google);
     preg_match_all("/<p><a\\s*href=\".*?\">(.*?)<\\/a><\\/p>/is", $Snoopy->results, $match);
     $googleTag = (array) array_unique($match[1]);
     $tagArray = array_merge($baiduTag, $googleTag);
     $tagArray = array_unique($tagArray);
     $ul = '<ul style="margin:0; padding:0;">';
     foreach ((array) $tagArray as $key => $tag) {
         $ul .= "<li><input onclick=\"inTag('{$tag}',{$key})\" id=\"gt_{$key}\" class='checkbox' type=\"checkbox\" value=\"{$tag}\" />{$tag}</li>\n";
     }
     $ul .= "</ul>";
     echo $ul;
 }
开发者ID:idreamsoft,项目名称:iCMS5.0,代码行数:25,代码来源:ajax.mo.php

示例4: price_book

function price_book($book)
{
    $amazon_url = "http://www.amazon.fr/gp/search/ref=sr_adv_b/?search-alias=stripbooks&__mk_fr_FR=%C5M%C5Z%D5%D1&unfiltered=1&field-author=&field-title=&field-isbn=&field-publisher=&field-collection=&node=&field-binding_browse-bin=492481011&field-dateop=&field-datemod=&field-dateyear=&sort=relevancerank&Adv-Srch-Books-Submit.x=0&Adv-Srch-Books-Submit.y=0";
    $amazon_url .= "&field-keywords=" . $book;
    $snoopy = new Snoopy();
    $snoopy->fetch($amazon_url);
    $html = $snoopy->results;
    $html = str_get_html($html);
    $prices = null;
    $results = $html->find('#atfResults', 0);
    if (isset($results)) {
        // book url
        $book_url = $results->find('.productTitle', 0);
        $book_url = $book_url->find('a', 0)->href;
        $ISBN = get_ISBN($book_url);
        $prices = get_best_price($ISBN);
    } else {
        $prices[0] = 0;
        $prices[1] = 0;
        $ISBN = -1;
        $book_url = 'http://www.amazon.fr';
    }
    $html->clear();
    unset($html);
    return array($prices[0], $prices[1], '2.99', $ISBN, $book_url);
}
开发者ID:92bondstreet,项目名称:old-school,代码行数:26,代码来源:update_awards_price.php

示例5: getGradeDetails

 public function getGradeDetails()
 {
     $studentData;
     $url = 'http://202.197.224.134:8083/jwgl/cj/cj1_cjLiebiao.jsp?xq=0&xkjc=&type=null&xkdl2=&xh=' . $this->sid . '&bh=null';
     $snoopy = new Snoopy();
     $snoopy->rawheaders['Cookie'] = $this->cookies;
     $snoopy->fetch($url);
     if ($snoopy->status != 200) {
         return $this->setMsg(3);
     }
     $data = iconv('gbk', 'utf-8', $snoopy->results);
     $data = str_replace('   style="color:red"', '', $data);
     $data = str_replace('&nbsp;', '', $data);
     preg_match_all('/\\<td\\>\\s+(.*?)\\s+\\<\\/td\\>\\s+\\<td\\>\\s+(.*?)\\s+\\<\\/td\\>\\s+\\<td\\>\\s+(.*?)\\s+\\<\\/td\\>\\s+\\<td\\>\\s+(.*?)\\s+\\<\\/td\\>\\s+\\<td\\>\\s+(.*?)\\s+\\<\\/td\\>\\s+\\<td\\>\\s+(.*?)\\s+\\<\\/td\\>\\s+\\<td\\>\\s+(.*?)\\s+\\<\\/td\\>/', $data, $matches);
     $num = count($matches[1]);
     for ($i = 1; $i < $num; $i++) {
         $studentData[$i - 1]['course'] = urlencode($matches[1][$i]);
         $studentData[$i - 1]['type'] = urlencode($matches[2][$i]);
         $studentData[$i - 1]['credit'] = urlencode($matches[3][$i]);
         $studentData[$i - 1]['daily_grade'] = urlencode($matches[4][$i]);
         $studentData[$i - 1]['exam_grade'] = urlencode($matches[5][$i]);
         $studentData[$i - 1]['comp_grade'] = urlencode($matches[6][$i]);
         $studentData[$i - 1]['term'] = urlencode($matches[7][$i]);
     }
     $this->studentData = $studentData;
 }
开发者ID:andreas39,项目名称:api.sky31.com,代码行数:26,代码来源:EduGradeDetails.class.php

示例6: get_read

function get_read($url = '', $key, $uid = 1)
{
    $wzurl = "http://mp.weixin.qq.com/s?{$url}&key={$key}&ascene=1&uin=Nzc5OTI2MTIx&pass_ticket=kzTtalLseTrEcwKVHswOVecGMByySYu94gRKdAXokFv2jg4UAOt%2FkrZHb0IwUlSB";
    $bsurl = "http://mp.weixin.qq.com/s?{$url}";
    require_once "Snoopy.class.php";
    $snoopy = new Snoopy();
    $snoopy->agent = "Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16";
    //伪装浏览器
    $snoopy->fetch($wzurl);
    //获取所有内容
    $content = $snoopy->results;
    //显示结果
    preg_match('/<span id="readNum">([^<]*)<\\/span>/si', $content, $read);
    preg_match('/var likeNum = \'([^<]*)\';/si', $content, $suport);
    // $content = htmlspecialchars($content);
    $content = str_replace(array("'", "\""), array("\\'", "\\\""), $content);
    if ($suport[1] == "赞") {
        $suprot = 0;
    }
    $read = (int) $read[1];
    $suport = (int) $suport[1];
    $connect = mysqli_connect("127.0.0.1", "root", "root") or die("链接数据库失败!");
    mysqli_select_db($connect, "wx_read") or die(mysqli_errno($connect));
    mysqli_query($connect, "SET NAMES 'utf8'");
    $sql = mysqli_query($connect, "INSERT INTO `wx_article` (`uid`, `url`, `content`, `reads`, `suports`) VALUES ('{$uid}','{$bsurl}','{$content}','{$read}','{$suport}');");
    echo "INSERT INTO `wx_article` (`uid`, `url`, `content`, `reads`, `suports`) VALUES ('{$uid}','{$bsurl}','{$content}','{$read}','{$suport}');";
}
开发者ID:uuking,项目名称:test,代码行数:27,代码来源:addURL.php

示例7: getRank

 public function getRank()
 {
     $studentData;
     $url = $this->generateUrl();
     $snoopy = new Snoopy();
     $snoopy->rawheaders['Cookie'] = $this->cookies;
     $snoopy->fetch($url);
     if ($snoopy->status != 200) {
         return $this->setMsg(3);
     }
     $data = iconv('gbk', 'utf-8', $snoopy->results);
     if (preg_match('/\\<td\\>\\s+平均绩点(必修)\\s+\\<\\/td\\>\\s+\\<td\\>\\s+(.*?)\\s+\\<\\/td\\>/', $data, $matches)) {
         $studentData['gpa'] = $matches[1];
     }
     if (preg_match('/\\<td\\>\\s+平均成绩(必修)\\s+\\<\\/td\\>\\s+\\<td\\>\\s+(.*?)\\s+\\<\\/td\\>/', $data, $matches)) {
         $studentData['average_grade'] = $matches[1];
     }
     if (preg_match('/\\<td\\>\\s+绩点班级排名(必修)\\s+\\<\\/td\\>\\s+\\<td\\>\\s+(.*?)\\s+\\<\\/td\\>/', $data, $matches)) {
         $studentData['gpa_class_rank'] = $matches[1];
     }
     if (preg_match('/\\<td\\>\\s+绩点专业排名(必修)\\s+\\<\\/td\\>\\s+\\<td\\>\\s+(.*?)\\s+\\<\\/td\\>/', $data, $matches)) {
         $studentData['gpa_major_rank'] = $matches[1];
     }
     $this->studentData = $studentData;
 }
开发者ID:andreas39,项目名称:api.sky31.com,代码行数:25,代码来源:EduRank.class.php

示例8: getUpdatedata

 /**
  * Logic for the Update Check
  *
  * @access public
  * @return object
  * @since 0.9
  */
 function getUpdatedata()
 {
     $elsettings = ELAdmin::config();
     include_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'classes' . DS . 'Snoopy.class.php';
     $snoopy = new Snoopy();
     //set the source file
     $file = 'http://update.schlu.net/elupdate.php';
     $snoopy->read_timeout = 30;
     $snoopy->agent = "Mozilla/5.0 (compatible; Konqueror/3.2; Linux 2.6.2) (KHTML, like Gecko)";
     $snoopy->fetch($file);
     $_updatedata = null;
     if ($snoopy->status != 200 || $snoopy->error) {
         $_updatedata->failed = 1;
     } else {
         $data = explode('|', $snoopy->results);
         $_updatedata->version = $data[0];
         $_updatedata->versiondetail = $data[1];
         $_updatedata->date = strftime($elsettings->formatdate, strtotime($data[2]));
         $_updatedata->info = $data[3];
         $_updatedata->download = $data[4];
         $_updatedata->notes = $data[5];
         $_updatedata->changes = explode(';', $data[6]);
         $_updatedata->failed = 0;
         $_updatedata->current = version_compare('0.9.0.0.alpha', $_updatedata->version);
     }
     return $_updatedata;
 }
开发者ID:reeleis,项目名称:ohiocitycycles,代码行数:34,代码来源:updatecheck.php

示例9: wpupdate_themeswordpressnet_search

function wpupdate_themeswordpressnet_search($args)
{
    $url = wpupdate_themeswordpressnet_searchCreate($args['info']);
    $url = 'http://themes.wordpress.net/?' . $url . '&submit=Show';
    if ($args['info']['page'] > 1) {
        $url .= '&paged=' . $args['info']['page'];
    }
    $results = wp_cache_get('wpupdate_searchThemesThemesWordpressNet_' . md5($url), 'wpupdate');
    if (!$results) {
        $results = array('results' => array(), 'pages' => 0);
        $snoopy = new Snoopy();
        $snoopy->fetch($url);
        preg_match_all('#<a href="(.*?)" rel="bookmark" title="(.*?)"><img src=".*/snapshots/(\\d+?)-thumb.jpg"#i', $snoopy->results, $mat1);
        if (!$mat1) {
            return $args;
        }
        for ($i = 0; $i < count($mat1[1]); $i++) {
            $id = $mat1[3][$i];
            $results['results'][] = array('name' => $mat1[2][$i], 'url' => $mat1[1][$i], 'id' => $id, 'download' => 'http://themes.wordpress.net/download.php?theme=' . $id, 'snapshot' => array('thumb' => 'http://s.themes.wordpress.net/snapshots/' . $id . '-thumb.jpg', 'medium' => 'http://s.themes.wordpress.net/snapshots/' . $id . '-medium.jpg', 'big' => 'http://s.themes.wordpress.net/snapshots/' . $id . '-big.jpg'), 'testrun' => 'http://themes.wordpress.net/testrun/?wptheme=' . $id);
        }
        //Check the number of pages, If this isnt the last page, change it.
        if (preg_match('#title="Last &raquo;">(\\d+)</a>#', $snoopy->results, $pages)) {
            $results['pages'] = (int) $pages[1];
        }
        wp_cache_add('wpupdate_searchThemesThemesWordpressNet_' . md5($url), $results, 'wpupdate', 21600);
    }
    //end if ( ! $results )
    //Merge Result set
    $args['results'] = array_merge($args['results'], $results['results']);
    //Check if theres more pages than set
    if ($results['pages'] > $args['info']['pages']) {
        $args['info']['pages'] = $results['pages'];
    }
    return $args;
}
开发者ID:AkimBolushbek,项目名称:wordpress-soc-2007,代码行数:35,代码来源:themes.wordpress.net.php

示例10: getName

/**
 * 学校验证
 * @method getName
 * @param  [type]  $stu_number [学号]
 * @param  [type]  $pwd        [密码]
 * @return [string/bool]              [验证成功返回姓名,验证失败返回false]
 * @author NewFuture[newfuture@yunyin.org]
 */
function getName($stu_number, $pwd)
{
    /*基本信息*/
    $ACTION_URL = 'http://jw.tifert.edu.cn/2003/Logon.do?method=logon';
    $INFO_URL = 'http://jw.tifert.edu.cn/2003/framework/main.jsp';
    $SUCCESS_KEY = '<script language=\'javascript\'>window.location.href=\'http://jw.tifert.edu.cn/2003/framework/main.jsp\';</script>';
    $START_FALG = '当前用户:';
    $END_FLAG = '</td>';
    $snoopy = new Snoopy();
    /*设置请求头,非必需 */
    $snoopy->referer = 'http://jw.tifert.edu.cn/2003/';
    $snoopy->rawheaders['Pragma'] = 'no-cache';
    $snoopy->rawheaders['X_FORWARDED_FOR'] = get_client_ip();
    /*用户学号和密码*/
    $input['USERNAME'] = $stu_number;
    $input['PASSWORD'] = $pwd;
    //模拟登陆
    $snoopy->submit($ACTION_URL, $input);
    $result = $snoopy->results;
    //登录结果页面
    if (strpos($result, $SUCCESS_KEY) === false) {
        /*验证失败*/
        return false;
    } else {
        /*登录成功,保存cookie信息页面抓取信息*/
        $snoopy->setcookies();
        $snoopy->fetch($INFO_URL);
        $results = $snoopy->results;
        $s = strpos($results, $START_FALG) + strlen($START_FALG);
        //起始位置
        $e = strpos($results, $END_FLAG, $s);
        $name = substr($results, $s, $e - $s);
        return trim($name);
    }
}
开发者ID:noikiy,项目名称:print,代码行数:43,代码来源:tifert_jw.php

示例11: renew

 private function renew()
 {
     $postArray = array('action' => 'Renew', 'book_barcode' => preg_match('/\\//', $this->bookID) ? $this->bookID : urlencode($this->bookID), 'department_id' => $this->deptID, 'library_id' => $this->libraryID);
     print_r($postArray);
     $studentData;
     $url = 'http://202.197.232.4:8081/opac_two/reader/jieshuxinxi.jsp';
     $snoopy = new Snoopy();
     $snoopy->rawheaders['Cookie'] = $this->cookies;
     $snoopy->submit($url, $postArray);
     if ($snoopy->status != 200) {
         return $this->setMsg(3);
     }
     $data = iconv('gbk', 'utf-8', $snoopy->results);
     if (preg_match('/续借成功/', $data)) {
         return $this->setMsg(0);
     } else {
         if (preg_match('/现已续借/', $data)) {
             return $this->setMsg(6);
         } else {
             if (preg_match('/读取续借规则错误/', $data)) {
                 return $this->setMsg(7);
             } else {
                 return $this->setMsg(4);
             }
         }
     }
 }
开发者ID:andreas39,项目名称:api.sky31.com,代码行数:27,代码来源:LibraryRenew.class.php

示例12: getReaderInfo

 private function getReaderInfo()
 {
     $studentData;
     $url = 'http://202.197.232.4:8081/opac_two/reader/reader_set.jsp';
     $snoopy = new Snoopy();
     $snoopy->rawheaders['Cookie'] = $this->cookies;
     $snoopy->fetch($url);
     if ($snoopy->status != 200) {
         return $this->setMsg(3);
     }
     $data = iconv('gbk', 'utf-8', $snoopy->results);
     if (preg_match('/\\<TD\\>读者姓名\\:\\<\\/TD\\>\\s+\\<TD\\>\\s+(.*?)\\s+\\<\\/TD\\>/', $data, $matches)) {
         $studentData['name'] = urlencode($matches[1]);
     }
     if (preg_match('/\\<TD\\>办证日期\\:\\<\\/TD\\>\\s+\\<TD\\>\\s+(.*?)\\s+\\<\\/TD\\>/', $data, $matches)) {
         $studentData['valid_date_start'] = urlencode($matches[1]);
     }
     if (preg_match('/\\<TD\\>到期日期\\:\\<\\/TD\\>\\s+\\<TD\\>\\s+(.*?)\\s+\\<\\/TD\\>/', $data, $matches)) {
         $studentData['valid_date_end'] = urlencode($matches[1]);
     }
     if (preg_match('/\\<TD\\>读者欠款\\:\\<\\/TD\\>\\s+\\<TD\\>\\s+(.*?)\\s+\\<\\/TD\\>/', $data, $matches)) {
         $studentData['debt'] = urlencode($matches[1] == 0 ? '0.00' : $matches[1] * 10 % 10 == 0 ? $matches[1] . '.00' : $matches[1] . '0');
     }
     $this->studentData = $studentData;
 }
开发者ID:andreas39,项目名称:api.sky31.com,代码行数:25,代码来源:LibraryReaderInfo.class.php

示例13: getDomainLinks

function getDomainLinks($url, $domain)
{
    global $domainLinks;
    $snoopy = new Snoopy();
    $snoopy->agent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17";
    $snoopy->rawheaders['Accept'] = 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8';
    $snoopy->rawheaders['Accept-Charset'] = 'GBK,utf-8;q=0.7,*;q=0.3';
    $snoopy->rawheaders['Connection'] = 'keep-alive';
    $snoopy->rawheaders['Accept-Language'] = 'zh-CN,zh;q=0.8';
    $snoopy->rawheaders['Cache-Control'] = 'max-age=0';
    $links = array();
    if ($snoopy->fetchlinks($url)) {
        foreach ($snoopy->results as $link) {
            if (stripos($link, $domain) === false) {
                continue;
            }
            if (in_array($link, $domainLinks)) {
                continue;
            }
            $domainLinks[] = $link;
            echo $link . "\r\n";
            getDomainLinks($link, $domain);
        }
    }
}
开发者ID:yangliGit,项目名称:MyWorks,代码行数:25,代码来源:getDomainLinks.php

示例14: SERVICE_GETLYRICS_lyricwiki

function SERVICE_GETLYRICS_lyricwiki($track)
{
    global $include_path;
    include_once $include_path . "lib/snoopy.class.php";
    $meta = $track->getMeta();
    $artist = $meta['artist'];
    $name = $meta['title'];
    // Let's up the max execution time here
    ini_set('max_execution_time', '60000');
    // Now let's see if we can get close...
    $snoopy = new Snoopy();
    $snoopy->fetch("http://lyricwiki.org/api.php?artist=" . urlencode($artist) . '&song=' . urlencode($name) . '&fmt=xml');
    $contents = $snoopy->results;
    unset($snoopy);
    // Now let's see if we got an exact match
    if (!stristr($contents, '<lyrics>Not found') and (stristr($contents, iconv("UTF-8", "ISO-8859-1", $artist)) and stristr($contents, iconv("UTF-8", "ISO-8859-1", $name)))) {
        $lyrics = "";
        // Ok, now let's get the ID number
        $lyrics = substr($contents, strpos($contents, "<lyrics>") + 8, 999999);
        $lyrics = stripslashes(substr($lyrics, 0, strpos($lyrics, "</lyrics>")));
    }
    if ($lyrics == "") {
        return false;
    }
    $lyrics2 = iconv("ISO-8859-1", "UTF-8", $lyrics);
    return $lyrics2;
}
开发者ID:seanfbrown,项目名称:jinzora,代码行数:27,代码来源:lyricwiki.php

示例15: get

 /**
  * @param $url
  * @param string $post_data
  * @return mixed|null
  */
 public static function get($url, $post_data = '')
 {
     $host2 = array('account/register.json', 'bankBranch/select/branch.json', 'account/bank/list.json', 'account/bankcard/bind.json', 'user/identity/auth.json', 'loginRest/getUserCenterInfo.json', 'account/bankcard/modify.json');
     $str = '';
     if (is_array($post_data)) {
         $post_data['_ts'] = time();
         $post_data['token'] = self::TOKEN;
         foreach ($post_data as $key => $value) {
             $str .= '&' . $key . '=' . urlencode(trim($value));
         }
     }
     try {
         $_snoopy = new Snoopy();
         if (in_array($url, $host2)) {
             $furl = Yii::app()->params['back_host2'] . $url . '?' . substr($str, 1, strlen($str));
         } else {
             $furl = Yii::app()->params['back_host'] . $url . '?' . substr($str, 1, strlen($str));
         }
         $_snoopy->fetch($furl);
         if ($_snoopy->results != '') {
             $data = json_decode($_snoopy->results, false);
         }
         self::json_log($_snoopy->results);
         return $data;
     } catch (Exception $ex) {
         return null;
     }
     return null;
 }
开发者ID:kl0428,项目名称:admin,代码行数:34,代码来源:HttpLib.php


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