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


PHP Snoopy::fetch方法代码示例

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


在下文中一共展示了Snoopy::fetch方法的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: 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

示例3: init

 private function init()
 {
     $snoopy = new Snoopy();
     //Get Viewstate First
     $snoopy->fetch('http://202.197.224.66:8084/pyxx/login.aspx');
     if ($snoopy->status != 200) {
         return $this->setMsg(3);
     }
     if (preg_match('/value="(.*?)"/', $snoopy->results, $viewstate)) {
         $this->postArray['__VIEWSTATE'] = $viewstate[1];
     } else {
         return $this->setMsg(3);
     }
     //Set SessionId
     $snoopy->cookies['ASP.NET_SessionId'] = $this->sessionId;
     //Submit Form
     $snoopy->submit('http://202.197.224.66:8084/pyxx/login.aspx', $this->postArray);
     if ($snoopy->status != 200) {
         return $this->setMsg(3);
     }
     if (preg_match('/密码错误/', $snoopy->results)) {
         return $this->setMsg(1);
     }
     if (!preg_match('/html/', $snoopy->results)) {
         return $this->setMsg(4);
     }
     //Get Student Info
     $snoopy->fetch('http://202.197.224.66:8084/pyxx/grgl/xsinfoshow.aspx');
     if ($snoopy->status != 200) {
         return $this->setMsg(3);
     }
     //echo $snoopy->results;
     if (!preg_match('/个人基本信息/', $snoopy->results)) {
         return $this->setMsg(4);
     }
     if (preg_match('/<span id="lblxm1">(.*?)<\\/span>/', $snoopy->results, $matches)) {
         $studentData['name'] = urlencode($matches[1]);
     } else {
         return $this->setMsg(4);
     }
     if (preg_match('/<span id="lblxb">(.*?)<\\/span>/', $snoopy->results, $matches)) {
         $studentData['sex'] = urlencode($matches[1]);
     }
     if (preg_match('/<span id="lblcsrq">(.*?)<\\/span>/', $snoopy->results, $matches)) {
         $studentData['date_of_birth'] = urlencode($matches[1]);
     }
     if (preg_match('/<span id="lbljtdq">(.*?)<\\/span>/', $snoopy->results, $matches)) {
         $studentData['location'] = urlencode($matches[1]);
     }
     if (preg_match('/<span id="lblyxzy">(.*?)<\\/span>/', $snoopy->results, $matches)) {
         $arr = explode('_', $matches[1]);
         $studentData['college'] = urlencode($arr[0]);
         $studentData['major'] = urlencode($arr[1]);
     }
     $this->studentData = $studentData;
     return $this->setMsg(0);
 }
开发者ID:andreas39,项目名称:api.sky31.com,代码行数:57,代码来源:ResearchStudentInfo.class.php

示例4: execute

 function execute($dummy = '', $max_entries = '')
 {
     $this->cache_life_time = max($this->cache_life_time, $this->mod_configs['fetch_cache_life_time']);
     $xml_source = '';
     if (!strstr($this->url, '://')) {
         $this->errors[] = _MD_D3PIPES_ERR_INVALIDURIINFETCH . "\n({$this->pipe_id})";
         return '';
     }
     $cache_result = $this->fetchCache();
     if ($cache_result !== false) {
         list($cached_time, $xml_source) = $cache_result;
         if ($cached_time + $this->cache_life_time > time()) {
             return $xml_source;
         }
     }
     require_once XOOPS_ROOT_PATH . '/class/snoopy.php';
     $snoopy = new Snoopy();
     $snoopy->maxredirs = 0;
     $snoopy->offsiteok = true;
     $snoopy->proxy_host = $this->mod_configs['snoopy_proxy_host'];
     $snoopy->proxy_port = $this->mod_configs['snoopy_proxy_port'];
     $snoopy->proxy_user = $this->mod_configs['snoopy_proxy_user'];
     $snoopy->proxy_pass = $this->mod_configs['snoopy_proxy_pass'];
     $snoopy->curl_path = $this->mod_configs['snoopy_curl_path'];
     $fetch_result = $snoopy->fetch($this->url);
     // check redirect
     if ($fetch_result && $snoopy->_redirectaddr && $this->mod_configs['snoopy_maxredirs'] > 0) {
         if (!empty($this->mod_configs['redirect_warning'])) {
             $this->errors[] = _MD_D3PIPES_ERR_REDIRECTED . "\n(" . $this->pipe_id . ")\n" . $this->url . " ->\n" . $snoopy->_redirectaddr;
         }
         $snoopy->maxredirs = $this->mod_configs['snoopy_maxredirs'];
         $fetch_result = $snoopy->fetch($this->url);
     }
     // check fetch error
     if (!$fetch_result || !($xml_source = $snoopy->results)) {
         $this->touchCache();
         $message = _MD_D3PIPES_ERR_CANTCONNECTINFETCH . "\n";
         if (!empty($snoopy->proxy_host)) {
             $message .= _MD_D3PIPES_ERR_DOUBTFULPROXY . "\n";
         }
         if (substr($this->url, 0, 5) == 'https') {
             $message .= _MD_D3PIPES_ERR_DOUBTFULCURLPATH . "\n";
         }
         $this->errors[] = $message . "({$this->pipe_id})";
         return '';
     }
     // check cache folder is writable
     if (!$this->storeCache($xml_source)) {
         $this->errors[] = _MD_D3PIPES_ERR_CACHEFOLDERNOTWRITABLE . "\nXOOPS_TRUST_PATH/cache ({$this->pipe_id})";
         return '';
     }
     return $xml_source;
 }
开发者ID:BackupTheBerlios,项目名称:peakxoops-svn,代码行数:53,代码来源:D3pipesFetchSnoopy.class.php

示例5: processData

 private function processData()
 {
     $url1 = 'http://ecard.xtu.edu.cn/accounthisTrjn1.action?account=' . $this->ecardID . '&inputObject=all&Submit=+%C8%B7+%B6%A8+';
     $url2 = 'http://ecard.xtu.edu.cn/accounthisTrjn2.action?inputStartDate=' . $this->startDate . '&inputEndDate=' . $this->endDate . '';
     $url3 = 'http://ecard.xtu.edu.cn/accounthisTrjn3.action';
     $url4 = 'http://ecard.xtu.edu.cn/accountconsubBrows.action?pageNum=';
     $studentData;
     $snoopy = new Snoopy();
     $snoopy->rawheaders['Cookie'] = $this->cookies;
     $snoopy->cookies['JSESSIONID'] = $this->sessionid;
     $snoopy->fetch($url1);
     if ($snoopy->status != 200) {
         return $this->setMsg(3);
     }
     $snoopy->fetch($url2);
     if ($snoopy->status != 200) {
         return $this->setMsg(3);
     }
     $snoopy->fetch($url3);
     if ($snoopy->status != 200) {
         return $this->setMsg(3);
     }
     $data = iconv('gbk', 'utf-8', $snoopy->results);
     if (!preg_match('/共(.*?)页/', $data, $matches)) {
         return $this->setMsg(3);
     }
     $num = $matches[1];
     $count = 0;
     for ($i = 1; $i <= $num; $i++) {
         $snoopy->fetch($url4 . $i);
         if ($snoopy->status != 200) {
             return $this->setMsg(3);
         }
         $data = iconv('gbk', 'utf-8', $snoopy->results);
         $data = str_replace(' ', '', $data);
         preg_match_all('/\\<tdalign="center"\\>(.*?)\\<\\/td\\>\\s+\\<tdalign="center"\\>(.*?)\\<\\/td\\>\\s+\\<tdalign="center"\\>(.*?)\\<\\/td\\>\\s+\\<tdalign="center"\\>(.*?)\\<\\/td\\>\\s+\\<tdalign="center"\\>(.*?)\\<\\/td\\>\\s+\\<!--tdalign="center"\\>###\\<\\/td--\\>\\s+\\<tdalign="right"\\>(.*?)\\<\\/td\\>\\s+\\<tdalign="right"\\>(.*?)\\<\\/td\\>\\s+\\<tdalign="center"\\>(.*?)\\<\\/td\\>\\s+\\<tdalign="center"\\>(.*?)\\<\\/td\\>\\s+\\<tdalign="center"\\>(.*?)\\<\\/td\\>/', $data, $matches);
         $listNum = count($matches[1]);
         for ($j = 0; $j < $listNum; $j++) {
             $studentData[$count]['date'] = urlencode(substr($matches[1][$j], 0, 10) . ' ' . substr($matches[1][$j], 10));
             $studentData[$count]['location'] = urlencode($matches[5][$j]);
             $studentData[$count]['amount'] = urlencode($matches[6][$j]);
             $studentData[$count]['balance'] = urlencode($matches[7][$j]);
             $studentData[$count]['time'] = urlencode($matches[8][$j]);
             $count++;
         }
     }
     $this->studentData = $studentData;
 }
开发者ID:andreas39,项目名称:api.sky31.com,代码行数:48,代码来源:EcardBilling.class.php

示例6: getStudentInfo

 public function getStudentInfo()
 {
     $studentData;
     $url = 'http://202.197.224.134:8083/jwgl/detail_zp.jsp?funcId=0&zzd=XJB.XH&zzdValue=' . $this->sid;
     $snoopy = new Snoopy();
     $snoopy->rawheaders['Cookie'] = $this->cookies;
     $snoopy->fetch($url);
     if ($snoopy->status != 200) {
         return $this->setMsg(3);
     }
     $data = iconv('GBK//IGNORE', 'utf-8//IGNORE', $snoopy->results);
     $data = str_replace('&nbsp;', '', $data);
     if (preg_match_all('/\\<td align="right"\\>\\s+姓名\\s+\\<\\/td\\>\\s+\\<td\\>\\s+(.*?)\\s+\\<\\/td\\>/', $data, $matches)) {
         $studentData['name'] = urlencode($matches[1][0]);
     }
     if (preg_match_all('/\\<td align="right"\\>\\s+性别\\s+\\<\\/td\\>\\s+\\<td\\>\\s+(.*?)\\s+\\<\\/td\\>/', $data, $matches)) {
         $studentData['sex'] = urlencode($matches[1][0]);
     }
     if (preg_match_all('/\\<td align="right"\\>\\s+出生日期\\s+\\<\\/td\\>\\s+\\<td\\>\\s+(.*?)\\s+\\<\\/td\\>/', $data, $matches)) {
         $studentData['date_of_birth'] = urlencode($matches[1][0]);
     }
     if (preg_match_all('/\\<td align="right"\\>\\s+籍贯码\\s+\\<\\/td\\>\\s+\\<td\\>\\s+(.*?)\\s+\\<\\/td\\>/', $data, $matches)) {
         $studentData['location'] = urlencode($matches[1][0]);
     }
     if (preg_match_all('/\\<td align="right"\\>\\s+院系所部\\s+\\<\\/td\\>\\s+\\<td\\>\\s+(.*?)\\s+\\<\\/td\\>/', $data, $matches)) {
         $studentData['college'] = urlencode($matches[1][0]);
     }
     if (preg_match_all('/\\<td align="right"\\>\\s+校内专业\\s+\\<\\/td\\>\\s+\\<td\\>\\s+(.*?)\\s+\\<\\/td\\>/', $data, $matches)) {
         $studentData['major'] = urlencode($matches[1][0]);
     }
     if (preg_match_all('/\\<td align="right"\\>\\s+班级\\s+\\<\\/td\\>\\s+\\<td\\>\\s+(.*?)\\s+\\<\\/td\\>/', $data, $matches)) {
         $studentData['class'] = urlencode($matches[1][0]);
     }
     $this->studentData = $studentData;
 }
开发者ID:andreas39,项目名称:api.sky31.com,代码行数:35,代码来源:EduStudentInfo.class.php

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例13: 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

示例14: 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

示例15: 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


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