コード例 #1
0
ファイル: stock.php プロジェクト: exchan1/php_lotto
function stock_val($n)
{
    $snoopy = new snoopy();
    $o = "";
    $html = '<tr>';
    $snoopy->fetch("http://stock.daum.net/item/main.daum?code=" . $n);
    $txt = $snoopy->results;
    $rex = "/\\<h2 onclick=\"GoPage.+\"\\>(.*)\\<\\/h2\\>/";
    preg_match_all($rex, $txt, $o);
    //print_r($o[0][0]);
    $html .= '<td>' . $o[0][0] . '</td>';
    $rex = "/\\<em class=\"curPrice.+\"\\>(.*)\\<\\/em\\>/";
    preg_match_all($rex, $txt, $o);
    //print_r($o[0][0]);
    $html .= '<td>' . $o[0][0] . '</td>';
    $html .= '</tr>';
    return $html;
}
コード例 #2
0
ファイル: WuLiu2.class.php プロジェクト: lughong/test
 protected function get_info($url)
 {
     //优先使用curl模式发送数据
     if (function_exists('curl_init') == 1) {
         $curl = curl_init();
         curl_setopt($curl, CURLOPT_URL, $url);
         curl_setopt($curl, CURLOPT_HEADER, 0);
         curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
         curl_setopt($curl, CURLOPT_TIMEOUT, 5);
         $get_content = curl_exec($curl);
         curl_close($curl);
     } else {
         include "snoopy.php";
         $snoopy = new snoopy();
         $snoopy->referer = 'http://www.google.com/';
         //伪装来源
         $snoopy->fetch($url);
         $get_content = $snoopy->results;
     }
     return $get_content;
 }
コード例 #3
0
ファイル: sms.php プロジェクト: Germey/yinxingpm
function check_smsbao_balance($account)
{
    $user = $account['sms_user'];
    $pass = md5($account['sms_pass']);
    $smsapi = smsbao_api_url();
    $snoopy = new snoopy();
    $sendurl = "http://{$smsapi}/query?u={$user}&p={$pass}";
    $snoopy->fetch($sendurl);
    $result = $snoopy->results;
    $code = explode("\n", $result);
    //返回代码类似  0\r 33123,1223  0表示成功,第一个数字表示已发送量,第二个数字表示剩余
    if (count($code) === 1) {
        return smsbao_status($statusStr);
    } else {
        if ($code[0] == 0) {
            $balance = $code[1];
            $balance = explode(",", $code[1]);
            // $already = $balance[0];
            // $left = $balance[1];
            return $balance;
            // return array("already" => $already, "left" => $left);
        }
    }
}
コード例 #4
0
ファイル: birthday.php プロジェクト: shashi12533/iitjee
<?php

/** Initial form for birthdays
 * @author : Abhay Rana
 */
error_reporting(E_ALL);
set_time_limit(1000000);
include "Snoopy.class.php";
$snoopy = new snoopy();
//$snoopy->_httprequest(
$snoopy->agent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";
$db = new mysqli("localhost", "root", "nemoabhay", "iitjee");
$re = $db->query("SELECT regno, form_no,date FROM `selected`");
while ($people = $re->fetch_row()) {
    $form = array();
    $url = "http://192.168.216.1/viewapp/index.php";
    $form['appln_no'] = $people[1];
    $form['regn_no'] = $people[0];
    $date_db = $people[2];
    if ($date_db) {
        continue;
    }
    echo $people[0] . "\n";
    for ($y = 1992; $y <= 1993; $y++) {
        for ($m = 1; $m <= 12; $m++) {
            for ($d = 1; $d <= 31; $d++) {
                $form['day'] = str_pad($d, 2, '0', STR_PAD_LEFT);
                $form['month'] = str_pad($m, 2, '0', STR_PAD_LEFT);
                $form['year'] = $y;
                $form['proceed'] = 'Proceed';
                $date = $form['day'] . "/" . $form['month'] . "/" . $form['year'];
コード例 #5
0
ファイル: kuaidi100_post.php プロジェクト: nanhuacrab/ecshop
include_once "kuaidi100_config.php";
if (isset($postcom) && isset($getNu)) {
    $url = 'http://www.kuaidi100.com/applyurl?key=' . $kuaidi100key . '&com=' . $postcom . '&nu=' . $getNu;
    // echo $url;
    //请勿删除变量$powered 的信息,否者本站将不再为你提供快递接口服务。
    $powered = '查询服务由:<a href="http://www.kuaidi100.com" target="_blank" style="color:blue">快递100</a> 网站提供';
    //优先使用curl模式发送数据
    if (function_exists('curl_init') == 1) {
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL, $url);
        curl_setopt($curl, CURLOPT_HEADER, 0);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
        curl_setopt($curl, CURLOPT_TIMEOUT, 5);
        $get_content = curl_exec($curl);
        curl_close($curl);
    } else {
        include "snoopy.php";
        $snoopy = new snoopy();
        $snoopy->fetch($url);
        $get_content = $snoopy->results;
    }
    //$get_content=iconv('UTF-8', 'GB2312//IGNORE', $get_content);
    //if(strpos($get_content,'地点和跟踪进度')== false){
    //  echo '查询失败,请重试';
    //}
    echo '<iframe src="' . $get_content . '" width="534" height="340" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no" allowtransparency="yes"><br/>' . $powered;
} else {
    echo '查询失败,请重试';
}
exit;
コード例 #6
0
 function Getwuliu($wuliu)
 {
     //加载快递公司
     $typeCom = $wuliu["logistics"];
     $typeNu = $wuliu["logisticsid"];
     include_once "ickd_companies.php";
     //include 'ickd_companies.php';
     $id = '106004';
     //请将123456替换成您在http://www.ickd.cn/api/reg.html申请到的id
     $secret = '9fe2da6307dcb2eed35989466f98c136';
     //您在http://www.ickd.cn/api/reg.html申请到的secret
     $url = 'http://api.ickd.cn/?id=' . $id . '&secret=' . $secret . '&com=' . $typeCom . '&nu=' . $typeNu . '&type=json&ord=desc&ver=2';
     //查询开始
     //优先使用curl模式发送数据
     if (function_exists('curl_init') == 1) {
         $curl = curl_init();
         curl_setopt($curl, CURLOPT_URL, $url);
         curl_setopt($curl, CURLOPT_HEADER, 0);
         curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
         curl_setopt($curl, CURLOPT_TIMEOUT, 5);
         $content = curl_exec($curl);
         curl_close($curl);
     } else {
         include "snoopy.php";
         $snoopy = new snoopy();
         $snoopy->referer = $_SERVER['HTTP_REFERER'];
         $snoopy->fetch($url);
         $content = $snoopy->results;
     }
     $content = mb_convert_encoding($content, 'utf8', 'gbk');
     $stat = json_decode($content, true);
     $wuliustat = $stat['status'];
     //dump($content);
     //die;
     return $wuliustat;
 }
コード例 #7
0
ファイル: all.php プロジェクト: shashi12533/iitjee
<?php

include "Snoopy.class.php";
$snoopy = new snoopy();
$snoopy->agent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";
$snoopy->rawheaders["Pragma"] = "no-cache";
$link = 'http://jee.iitm.ac.in/post-exam/Counseling/INDIVIDUAL_PDF/';
$snoopy->fetchlinks($link);
foreach ($snoopy->results as $link) {
    $link = substr($link, -11, 7);
    echo $link . "<br>";
}
コード例 #8
0
ファイル: index.php プロジェクト: exchan1/php_lotto
<?php

/*
 * 로또 분석 프로그램
 * 2015.09.24 - 최초 프로그램 작성 >> 기존의 당첨된 로또번호를 웹에서 가져와서 화면출력
 */
include 'class.snoopy.php';
header("Content-Type: text/html; charset=UTF-8");
$snoopy = new snoopy();
$getUrl = "http://www.645lotto.net/lotto645Confirm.do?method=byWin&drwNo=" . $_GET['kai'];
$snoopy->fetch($getUrl);
$pattern = '/<option value="[0-9]*"\\s*>(.*?)<\\/option>/';
preg_match_all($pattern, $snoopy->results, $out);
$select = '';
echo '<select onchange="location.href=\'?kai=\'+this.value">';
echo '<option value="">선택</option>';
for ($i = 0; $i < sizeof($out[0]); $i++) {
    echo $out[0][$i];
}
echo '</select>';
echo $_GET['kai'] ? '<br />' . $_GET['kai'] . '회차<br />' : '';
if ($_GET['kai']) {
    echo '<p>';
    $pattern = '/img src="\\/img\\/common\\/ball_[0-9]*.png/';
    preg_match_all($pattern, $snoopy->results, $out);
    for ($i = 0; $i <= 6; $i++) {
        $num[$i] = str_replace(".png", "", str_replace('img src="/img/common/ball_', "", $out[0][$i]));
        echo $i == 6 ? '보너스 : ' : '';
        echo $num[$i] . '<br />';
    }
    echo '</p>';
コード例 #9
0
ファイル: amazon.php プロジェクト: ndawe/Now-Reading-Redux
/**
 * Fetches and parses XML from Amazon for the given query.
 * @param string $query Query string containing variables to search Amazon for. Valid variables: $isbn, $title, $author
 * @return array Array containing each book's information.
 */
function query_amazon( $query ) {

    require_once dirname(__FILE__) . '/sha256.inc.php';

    if (!function_exists('hmac'))
      {
       function hmac($key, $data, $hashfunc='sha256')
        {
         $blocksize=64;

         if (strlen($key) > $blocksize) $key=pack('H*', $hashfunc($key));
         $key=str_pad($key, $blocksize, chr(0x00));
         $ipad=str_repeat(chr(0x36), $blocksize);
         $opad=str_repeat(chr(0x5c), $blocksize);
         $hmac = pack('H*', $hashfunc(($key^$opad) . pack('H*', $hashfunc(($key^$ipad) . $data))));
         return $hmac;
        }
      }

    global $item, $items;

    $options = get_option('nowReadingOptions');

    $using_isbn = false;

    parse_str($query);

    if ( empty($isbn) && empty($title) && empty($author) )
        return false;

    if ( !empty($isbn) )
        $using_isbn = true;

    // Our query needs different vars depending on whether or not we're searching by ISBN, so build it here.
    if ( $using_isbn ) {
        $isbn = preg_replace('#([^0-9x]+)#i', '', $isbn);
        $query = "isbn:$isbn";
    } else {
        $query='';
        if ( !empty($title) )
            $query = 'title:' . urlencode($title);
        if ( !empty($author) )
            $query .= 'author:' . urlencode($author);
    }

    // these items MUST be set in the Options screen
    $AWSAccessKeyId = trim($options['AWSAccessKeyId']);
    $SecretAccessKey = trim($options['SecretAccessKey']);

    # // some paramters
    $method = "GET";
    $host = "ecs.amazonaws".$options['domain'];
    $uri = "/onca/xml";

    // additional parameters
    $params["Service"] = "AWSECommerceService";
    // GMT timestamp
    $params["Timestamp"] = gmdate("Y-m-d\TH:i:s\Z");
    // API version
    $params["Version"] = "2009-03-31";
    $params["AssociateTag"] = urlencode($options['associate']);
    $params["Power"] = $query;
    $params["Operation"] = "ItemSearch";
    $params["SearchIndex"] = "Books";
    $params["ResponseGroup"] = "Request,Large,Images,AlternateVersions";
    $params["AWSAccessKeyId"] = $AWSAccessKeyId;

    // Sort paramters
    ksort($params);

   // re-build the request
   $request = array();
    foreach ($params as $parameter=>$value)
     {
      $parameter = str_replace("_", ".", $parameter);
      $parameter = str_replace("%7E", "~", rawurlencode($parameter));
      $value = str_replace("%7E", "~", rawurlencode($value));
      $request[] = $parameter . "=" . $value;
     }
   $request = implode("&", $request);

   $signatureString = $method . chr(10) . $host . chr(10) . $uri . chr(10) . $request;

   $signature = urlencode(base64_encode(hmac($SecretAccessKey, $signatureString)));

   $request = "http://" . $host . $uri . "?" . $request . "&Signature=" . $signature;

    // Fetch the XML using either Snoopy or cURL, depending on our options.
    if ( $options['httpLib'] == 'curl' ) {
        if ( !function_exists('curl_init') ) {
            return new WP_Error('curl-not-installed', __('cURL is not installed correctly.', NRTD));
        } else {
            $ch = curl_init();

            curl_setopt($ch, CURLOPT_URL, $request);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($ch, CURLOPT_USERAGENT, 'Now Reading ' . NOW_READING_VERSION);
            curl_setopt($ch, CURLOPT_HEADER, 0);

            if ( !empty($options['proxyHost']) ) {
                $proxy = $options['proxyHost'];

                if ( !empty($options['proxyPort']) ) {
                    $proxy .= ":{$options['proxyPort']}";
                }

                curl_setopt($ch, CURLOPT_PROXY, $proxy);
            }

            $xmlString = curl_exec($ch);

            curl_close($ch);
        }
    } else {
        require_once ABSPATH . WPINC . '/class-snoopy.php';

        $snoopy = new snoopy;
        $snoopy->agent = 'Now Reading Redux' . NOW_READING_VERSION;

        if ( !empty($options['proxyHost']) )
            $snoopy->proxy_host = $options['proxyHost'];
        if ( !empty($options['proxyHost']) && !empty($options['proxyPort']) )
            $snoopy->proxy_port = $options['proxyPort'];

        $snoopy->fetch($request);

        $xmlString = $snoopy->results;
    }

    if ( empty($xmlString) ) {
        do_action('nr_search_error', $query);
        echo '
        <div id="message" class="error fade">
            <p><strong>' . __("Oops!") . '</strong></p>
            <p>' . sprintf(__("For some reason, I couldn't search for your book on amazon%s.", NRTD), $options['domain']) . '</p>
            <p>' . __("Amazon's Web Services may be down, or there may be a problem with your server configuration.") . '</p>

                    ';
        if ( $options['httpLib'] )
            echo '<p>' . __("Try changing your HTTP Library setting to <strong>cURL</strong>.", NRTD) . '</p>';
        echo '
        </div>
        ';
        return false;
    }

    require_once 'xml/IsterXmlSimpleXMLImpl.php';

    $impl = new IsterXmlSimpleXMLImpl;
    $xml = $impl->load_string($xmlString);

    if ( $options['debugMode'] )
        robm_dump("Amazon Search XML:", htmlentities(str_replace(">", ">\n", $xmlString)));

    $items = $xml->ItemSearchResponse->Items->children();
    if (count($items) == 0)
    {
        return false;
    }

    $results = array();
    foreach ($items as $item)
    {
        $attr = $item->ItemAttributes;
        if (!$attr)
        {
            continue;
        }

        $asin = $item->ASIN->CDATA();
        if (empty($asin))
        {
            continue;
        }

        // Get full meta-data given the current ISBN. Used to get all editions.
        $metaData = getMetadataFromIsbn($asin, $AWSAccessKeyId, $SecretAccessKey, urlencode($options['associate']));
        if ($options['debugMode'])
        {
            robm_dump("Amazon Lookup XML:", htmlentities(str_replace(">", ">\n", $metaData)));
        }

        $metaDataParser = new IsterXmlSimpleXMLImpl;
        $metaDataXml = $metaDataParser->load_string($metaData);

        if (isset($metadata->ItemLookupResponse->Items->Request->Errors))
        {
            continue;//$metadata->ItemLookupResponse->Items->Request->Errors;
        }

        $editions = $metaDataXml->ItemLookupResponse->Items->children();
        if (count($editions) == 0)
        {
            continue;
        }

        // For each edition, add an entry.
        foreach ($editions as $edition)
        {
			if (!isset($edition->ASIN))
			{
			    continue;
			}

            $asin = $edition->ASIN->CDATA();
            if (empty($asin))
            {
                continue;
            }

            $title = $edition->ItemAttributes->Title->CDATA();
            if (empty($title))
            {
                continue;
            }

            $author = '';
            if (is_array($edition->ItemAttributes->Author))
            {
                foreach ($edition->ItemAttributes->Author as $a)
                {
                    if (is_object($a))
                    {
                        $author .= $a->CDATA() . ', ';
                    }
                }

                $author = substr($author, 0, -2);
            }
            else
            {
                if (is_object($edition->ItemAttributes->Author))
                {
                    $author = $edition->ItemAttributes->Author->CDATA();
                }
            }

            if (empty($author))
            {
                $author = apply_filters('default_book_author', 'Unknown');
            }

            $size = "{$options['imageSize']}Image";
            if (empty($item->$size))
            {
                continue;
            }

            $image = $item->$size->URL->CDATA();
            if (empty($image))
            {
                $image = get_option('siteurl') . '/wp-content/plugins/now-reading-redux/no-image.png';
            }

            $binding = '';
			if (isset($edition->ItemAttributes->Binding))
			{
				$binding = $edition->ItemAttributes->Binding->CDATA();
			}

			$ed = '';
			if (isset($edition->ItemAttributes->Edition))
			{
				$ed = $edition->ItemAttributes->Edition->CDATA();
			}

            $date = '';
			if (isset($edition->ItemAttributes->PublicationDate))
			{
				$date = $edition->ItemAttributes->PublicationDate->CDATA();
			}

			$publisher = '';
			if (isset($edition->ItemAttributes->Publisher))
			{
				$publisher = $edition->ItemAttributes->Publisher->CDATA();
			}

            if ($options['debugMode'])
            {
                robm_dump("book:", $author, $title, $binding, $ed, $date, $publisher, $asin);
            }

            $results[] = apply_filters('raw_amazon_results', compact('author', 'title', 'binding', 'ed', 'date', 'publisher', 'image', 'asin'));
        }
    }

    $results = apply_filters('returned_books', $results);

    return $results;
}
コード例 #10
0
ファイル: image.php プロジェクト: 0hyeah/yurivn
require_once MCWD . '/support/Snoopy.class.php';
$args = process_input(array('url' => STRING, 'w' => INTEGER, 'h' => INTEGER));
if (isset($args['w']) && ($args['w'] > 1024 || $args['w'] <= 0)) {
    $args['w'] = 75;
}
if (isset($args['h']) && ($args['h'] > 1024 || $args['h'] <= 0)) {
    $args['h'] = 75;
}
if (!$args['url']) {
    return;
}
if (!extension_loaded('gd') && !extension_loaded('gd2')) {
    trigger_error("GD is not loaded", E_USER_ERROR);
    exit;
}
$snoopy = new snoopy();
$snoopy->cookies = $_COOKIE;
$args['url'] = trim(str_replace(' ', '%20', $args['url']));
if ($snoopy->fetch($args['url'])) {
    $image = @imagecreatefromstring($snoopy->results);
    if ($image) {
        if (isset($args['w']) && isset($args['h'])) {
            $oldwidth = imagesx($image);
            $oldheight = imagesy($image);
            $newwidth = $oldwidth;
            $newheight = $oldheight;
            if ($oldwidth > $oldheight) {
                $newwidth = $args['w'];
                $newheight = (double) $newwidth / (double) $oldwidth * $oldheight;
            } else {
                $newheight = $args['h'];
コード例 #11
0
ファイル: sms.php プロジェクト: noikiy/mdwp
function sms_send_smsbao($phone, $content) {
	global $INI;
	
	if (empty($content)) {
		return '短信内容为空?写点吧~';
	}





	$content = Utility::Content($content);

	//配置信息
	$smsapi = "api.smsbao.com";					//短信网关
	$charset = "utf8";							//文件编码
	$user = $INI['sms']['smsbao_user']; 		//短信平台帐号
	$pass = md5($INI['sms']['smsbao_pass']);			//短信平台密码
	$wwwprefix = $INI['system']['wwwprefix'];
	
	$statusStr = array(
		"0" => "短信发送成功",
		"-1" => "参数不全",
		"-2" => "服务器空间不支持,请确认支持curl或者fsocket,联系您的空间商解决或者更换空间!",
		"30" => "密码错误",
		"40" => "账号不存在",
		"41" => "余额不足",
		"42" => "帐户已过期",
		"43" => "IP地址限制",
		"50" => "内容含有敏感词"
	);

	if (function_exists('curl_exec') == 1)
	{
		//发送地址
		$sendurl = "http://{$smsapi}/sms?u={$user}&p={$pass}&m={$phone}&c=".urlencode($content)."&r=".urlencode($wwwprefix."/api/smsbao.php?type=feedback");
		$result = Utility::HttpRequest($sendurl);
	}else{
		include_once("snoopy.php");
		$snoopy = new snoopy();
		$sendurl = "http://{$smsapi}/sms?u={$user}&p={$pass}&m={$phone}&c=".urlencode($content)."&r=".urlencode($wwwprefix."/api/smsbao.php?type=feedback");
		$snoopy->fetch($sendurl);
		$result = $snoopy->results;
	}
	
	if (trim(strval($result))=='') $result='-2';
	$code = intval(trim($result));
	if($code == 0){
		return true;
	}else{
		return $statusStr[$code];
  }
}
コード例 #12
0
ファイル: jee4.php プロジェクト: shashi12533/iitjee
<?php

error_reporting(E_ALL);
set_time_limit(1000000);
include "Snoopy.class.php";
$snoopy = new snoopy();
$snoopy->agent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";
$snoopy->rawheaders["Pragma"] = "no-cache";
$link = 'http://jee.iitm.ac.in/counseling/marks/iitd/index.php';
$db = mysqli_connect('localhost', 'captnemo_user', 'password', 'captnemo_db');
if (!$db) {
    die("death");
}
$q = "SELECT * FROM results where course <> 'Not Allotted'";
$res = mysqli_query($db, $q);
while ($row = mysqli_fetch_row($res)) {
    $form['Form_No'] = $ff = $row[0];
    $name = str_replace(" ", "", trim($row[1]));
    $name = substr($name, 0, 4);
    $form['Form_No'] .= $name;
    $form['submit'] = 'Submit';
    //echo $form['Form_No'];
    $link = "http://jee.iitm.ac.in/allotcourses/courseallot.php?name=" . $form['Form_No'];
    $snoopy->fetch($link, $form);
    //$snoopy->fetch("http://jee.iitm.ac.in/allotcourses/courseallot.php?name=".$ff.$name);
    $page = $snoopy->results;
    //$course='Unalloted due to various reasons<sup>[1]</sup>';
    //echo $page;
    $course = trim(strip_tags(cut_str($page, 'Course Allotted', 'Degree & Institute')));
    if (strlen($course) < 3) {
        $course = 'Not Allotted';
コード例 #13
0
ファイル: checkstatus.php プロジェクト: 0hyeah/yurivn
if (file_exists(DIR . '/forumrunner/sitekey.php')) {
    require_once DIR . '/forumrunner/sitekey.php';
} else {
    if (file_exists(DIR . '/forumrunner/vb_sitekey.php')) {
        require_once DIR . '/forumrunner/vb_sitekey.php';
    }
}
// You must have your valid Forum Runner forum site key.  This can be
// obtained from http://www.forumrunner.com in the Forum Manager.
if (!$mykey || $mykey == '') {
    exit;
}
// Check to see if our prompt is disabled.  If so, exit.
if (!$vbulletin->options['forumrunner_redirect_onoff']) {
    return;
}
// We know we have a prompt enabled at this point.  Phone home for status.
$snoopy = new snoopy();
$snoopy->submit('http://www.forumrunner.com/forumrunner/request.php', array('cmd' => 'checkstatus', 'sitekey' => $mykey));
$json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
$out = $json->decode($snoopy->results);
if (!$out['success']) {
    // If request failed for any reason, do not change anything.
    return;
}
if ($out['data']['pub']) {
    // We are published and fine.
    return;
}
// We are unpublished.  Disable prompt.
$vbulletin->db->query_write("\n    UPDATE " . TABLE_PREFIX . "setting\n    SET value = 0\n    WHERE varname = 'forumrunner_redirect_onoff'\n");
コード例 #14
0
ファイル: site.php プロジェクト: cedwards-reisys/nexus-web
 function forumrunner_image($default)
 {
     define('MCWD', DIR . '/packages/forumrunner');
     require_once MCWD . '/support/utils.php';
     require_once MCWD . '/support/Snoopy.class.php';
     $args = process_input(array('url' => STRING, 'w' => INTEGER, 'h' => INTEGER));
     if (isset($args['w']) && ($args['w'] > 1024 || $args['w'] <= 0)) {
         $args['w'] = 75;
     }
     if (isset($args['h']) && ($args['h'] > 1024 || $args['h'] <= 0)) {
         $args['h'] = 75;
     }
     if (!isset($args['url'])) {
         die;
     }
     if (!extension_loaded('gd') && !extension_loaded('gd2')) {
         trigger_error("GD is not loaded", E_USER_ERROR);
         die;
     }
     $snoopy = new snoopy();
     $snoopy->cookies = $_COOKIE;
     $args['url'] = trim(str_replace(' ', '%20', $args['url']));
     if ($snoopy->fetch($args['url'])) {
         $image = @imagecreatefromstring($snoopy->results);
         if ($image) {
             if (isset($args['w']) && isset($args['h'])) {
                 $oldwidth = imagesx($image);
                 $oldheight = imagesy($image);
                 $newwidth = $oldwidth;
                 $newheight = $oldheight;
                 if ($oldwidth > $oldheight) {
                     $newwidth = $args['w'];
                     $newheight = (double) $newwidth / (double) $oldwidth * $oldheight;
                 } else {
                     $newheight = $args['h'];
                     $newwidth = (double) $newheight / (double) $oldheight * $oldwidth;
                 }
                 $new_image = imagecreatetruecolor($newwidth, $newheight);
                 imagecopyresampled($new_image, $image, 0, 0, 0, 0, $newwidth, $newheight, imagesx($image), imagesy($image));
                 header('Content-type: image/jpeg');
                 imagejpeg($new_image);
                 exit;
             } else {
                 header('Content-type: image/jpeg');
                 imagejpeg($image);
                 exit;
             }
         }
     }
 }
コード例 #15
0
ファイル: amazon.php プロジェクト: phinze/wp-nowreading
/**
 * Fetches and parses XML from Amazon for the given query.
 * @param string $query Query string containing variables to search Amazon for. Valid variables: $isbn, $title, $author
 * @return array Array containing each book's information.
 */
function query_amazon($query)
{
    global $item, $items;
    $options = get_option('nowReadingOptions');
    $using_isbn = false;
    parse_str($query);
    if (empty($isbn) && empty($title) && empty($author)) {
        return false;
    }
    if (!empty($isbn)) {
        $using_isbn = true;
    }
    // Our query needs different vars depending on whether or not we're searching by ISBN, so build it here.
    $query = '';
    if ($using_isbn) {
        $isbn = preg_replace('#([^0-9x]+)#i', '', $isbn);
        $query = "isbn:{$isbn}";
    } else {
        if (!empty($title)) {
            $query = 'title:' . urlencode("{$title} ");
        }
        if (!empty($author)) {
            $query .= 'author:' . urlencode("{$author} ");
        }
    }
    $url = 'http://webservices.amazon' . $options['domain'] . '/onca/xml?Service=AWSECommerceService' . '&AWSAccessKeyId=0BN9NFMF20HGM4ND8RG2&Operation=ItemSearch&SearchIndex=Books&ResponseGroup=Request,Large,Images' . '&Version=2005-03-23&AssociateTag=' . urlencode($options['associate']) . '&Power=' . $query;
    $url = apply_filters('amazon_search_url', $url);
    // Fetch the XML using either Snoopy or cURL, depending on our options.
    if ($options['httpLib'] == 'curl') {
        if (!function_exists('curl_init')) {
            return new WP_Error('curl-not-installed', __('cURL is not installed correctly.', NRTD));
        } else {
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, $url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($ch, CURLOPT_USERAGENT, 'Now Reading ' . NOW_READING_VERSION);
            curl_setopt($ch, CURLOPT_HEADER, 0);
            if (!empty($options['proxyHost'])) {
                $proxy = $options['proxyHost'];
                if (!empty($options['proxyPort'])) {
                    $proxy .= ":{$options['proxyPort']}";
                }
                curl_setopt($ch, CURLOPT_PROXY, $proxy);
            }
            $xmlString = curl_exec($ch);
            curl_close($ch);
        }
    } else {
        require_once ABSPATH . WPINC . '/class-snoopy.php';
        $snoopy = new snoopy();
        $snoopy->agent = 'Now Reading ' . NOW_READING_VERSION;
        if (!empty($options['proxyHost'])) {
            $snoopy->proxy_host = $options['proxyHost'];
        }
        if (!empty($options['proxyHost']) && !empty($options['proxyPort'])) {
            $snoopy->proxy_port = $options['proxyPort'];
        }
        $snoopy->fetch($url);
        $xmlString = $snoopy->results;
    }
    if (empty($xmlString)) {
        do_action('nr_search_error', $query);
        return false;
    }
    $xml = new SimpleXMLElement($xmlString);
    $results = array();
    foreach ($xml->Items->Item as $item) {
        $book = array();
        $book['asin'] = (string) $item->ASIN;
        if (empty($book['asin'])) {
            continue;
        }
        foreach ($item->ItemAttributes->children() as $attribute) {
            if ($attribute->getName() == 'Author' && !empty($book['author'])) {
                $book['author'] .= ' and ' . (string) $attribute;
                continue;
            }
            $book[strtolower($attribute->getName())] = (string) $attribute;
        }
        $size = "{$options['imageSize']}Image";
        $book['image'] = (string) $item->{$size}->URL;
        if (empty($book['image'])) {
            $image = get_option('siteurl') . '/wp-content/plugins/now-reading/no-image.png';
        }
        $results[] = apply_filters('raw_amazon_results', $book);
    }
    $results = apply_filters('returned_books', $results);
    return $results;
}
コード例 #16
0
ファイル: Push.php プロジェクト: Sywooch/forums
 public static function doPush()
 {
     require_once MCWD . '/sitekey.php';
     require_once MCWD . '/version.php';
     $debug = false;
     $db = XenForo_Application::get('db');
     $visitor = XenForo_Visitor::getInstance();
     $watch_model = XenForo_Model::create('XenForo_Model_ThreadWatch');
     // You must have your valid Forum Runner forum site key.  This can be
     // obtained from http://www.forumrunner.com in the Forum Manager.
     if (!$mykey || $mykey == '') {
         return;
     }
     // First of all, expire all users who have not logged in for 2 weeks, so
     // we don't keep spamming the server with their entries.
     $db->query("\n\t    DELETE FROM xf_forumrunner_push_users\n\t    WHERE last_login < DATE_SUB(NOW(), INTERVAL 14 DAY)\n\t");
     // Get list of users to check for updates to push
     $users = $db->fetchAll("\n\t    SELECT user_id, fr_username, b, token\n\t    FROM xf_forumrunner_push_users\n\t");
     $out_msg = array();
     foreach ($users as $user) {
         $conversations = $subscriptions = array();
         $convs = $db->fetchAll("\n\t\tSELECT conversation_master.*,\n\t\t    conversation_user.*,\n\t\t    conversation_starter.*,\n\t\t    conversation_recipient.recipient_state, conversation_recipient.last_read_date\n\t\tFROM xf_conversation_user AS conversation_user\n\t\tINNER JOIN xf_conversation_master AS conversation_master ON\n\t\t    (conversation_user.conversation_id = conversation_master.conversation_id)\n\t\tINNER JOIN xf_conversation_recipient AS conversation_recipient ON\n\t\t    (conversation_user.conversation_id = conversation_recipient.conversation_id\n\t\t    AND conversation_user.owner_user_id = conversation_recipient.user_id)\n\t\tLEFT JOIN xf_user AS conversation_starter ON\n\t\t    (conversation_starter.user_id = conversation_master.user_id)\n\t\tWHERE conversation_user.owner_user_id = ? AND conversation_user.is_unread = 1\n\t\tORDER BY conversation_user.last_message_date DESC\n\t    ", $user['user_id']);
         // This is the list of all conversations with unread messages
         foreach ($convs as $conv) {
             // Let's see if we sent a notice for this conversation already
             $sentconversation = $db->fetchRow("\n\t\t    SELECT * FROM xf_forumrunner_push_data\n\t\t    WHERE conversation_id = ? AND user_id = ?", array($conv['conversation_id'], $user['user_id']));
             if ($sentconversation) {
                 // We have sent a notice about this conversation at some point, lets see if
                 // our update is newer.
                 if ($sentconversation['threadread'] < $conv['last_activity']) {
                     // Yup.  Send a notice and update table.
                     if ($sentconversation['subsent']) {
                         continue;
                     }
                     $conversations[] = array('conversationid' => $conv['conversation_id'], 'last_message_username' => $conv['last_message_username']);
                     if ($debug) {
                         continue;
                     }
                     $db->query("\n\t\t\t    UPDATE xf_forumrunner_push_data\n\t\t\t    SET threadread = ?, subsent = 1\n\t\t\t    WHERE id = ?", array($conv['last_activity'], $sentconversation['id']));
                 }
                 // Already sent update
             } else {
                 // Nope, send an update and insert new
                 $conversations[] = array('conversationid' => $conv['conversation_id'], 'last_message_username' => $conv['last_message_username']);
                 if ($debug) {
                     continue;
                 }
                 $db->query("\n\t\t\tINSERT INTO xf_forumrunner_push_data\n\t\t\t(user_id, conversation_id, threadread, subsent)\n\t\t\tVALUES (?, ?, ?, ?)", array($user['user_id'], $conv['conversation_id'], $conv['last_activity'], 1));
             }
         }
         unset($convs);
         // Now subscribed (watched) threads
         $watched = $watch_model->getThreadsWatchedByUser($user['user_id'], true);
         foreach ($watched as $watch) {
             // This is an updated thread since last time they were on the forum
             // Let's see if we sent this already
             $sentsubscription = $db->fetchRow("\n\t\t    SELECT * FROM xf_forumrunner_push_data\n\t\t    WHERE thread_id = ? AND user_id = ?", array($watch['thread_id'], $user['user_id']));
             if ($sentsubscription) {
                 // We have sent a notice about this thread at some point, lets see if
                 // our update is newer.
                 if ($sentsubscription['threadread'] < $watch['last_post_date']) {
                     // Yup.  Send a notice and update table.
                     if ($sentsubscription['subsent']) {
                         continue;
                     }
                     $subscriptions[] = array('threadid' => $watch['thread_id'], 'title' => $watch['title']);
                     if ($debug) {
                         continue;
                     }
                     $db->query("\n\t\t\t    UPDATE xf_forumrunner_push_data\n\t\t\t    SET threadread = ?, subsent = 1\n\t\t\t    WHERE id = ?", array($watch['last_post_date'], $sentsubscription['id']));
                 }
                 // Already sent update
             } else {
                 // Nope, send an update and insert new
                 $subscriptions[] = array('threadid' => $watch['thread_id'], 'title' => $watch['title']);
                 if ($debug) {
                     continue;
                 }
                 $db->query("\n\t\t\tINSERT INTO xf_forumrunner_push_data\n\t\t\t(user_id, thread_id, threadread, subsent)\n\t\t\tVALUES (?, ?, ?, ?)", array($user['user_id'], $watch['thread_id'], $watch['last_post_date'], 1));
             }
         }
         unset($watched);
         $total = count($subscriptions) + count($conversations);
         // Nothing to see here... move along....
         $hasconv = count($conversations) > 0;
         $hassub = count($subscriptions) > 0;
         if (!$hasconv && !$hassub) {
             continue;
         }
         // Forum name is always first arg.
         $msgargs = array(base64_encode(XenForo_Application::get('options')->boardTitle));
         $convpart = 0;
         if ($hasconv) {
             if (count($conversations) > 1) {
                 $msgargs[] = base64_encode(count($conversations));
                 $convpart = 2;
             } else {
                 $first_conv = array_shift($conversations);
                 $msgargs[] = base64_encode($first_conv['last_message_username']);
                 $convpart = 1;
             }
         }
         $subpart = 0;
         if ($hassub) {
             if (count($subscriptions) > 1) {
                 $msgargs[] = base64_encode(count($subscriptions));
                 $subpart = 2;
             } else {
                 $first_sub = array_shift($subscriptions);
                 $msgargs[] = base64_encode($first_sub['title']);
                 $subpart = 1;
             }
         }
         $data = array('b' => $user['b'], 'pm' => $hasconv, 'subs' => $hassub, 'm' => "__FR_PUSH_{$convpart}PM_{$subpart}SUB", 'a' => $msgargs, 't' => $total);
         if ($user['token']) {
             // Branded app - send along token
             $data['token'] = $user['token'];
         } else {
             if ($user['fr_username']) {
                 // Non branded app - send along push notification username
                 $data['u'] = $user['fr_username'];
             }
         }
         $out_msg[] = $data;
     }
     // Send our update to Forum Runner central push server.  Silently fail if
     // necessary.
     if (count($out_msg) > 0) {
         $snoopy = new snoopy();
         $snoopy->submit('http://push.forumrunner.com/push.php', array('k' => $mykey, 'm' => serialize($out_msg), 'v' => $fr_version, 'p' => $fr_platform));
     }
 }
コード例 #17
0
ファイル: ashwini.php プロジェクト: ravikishore1993/iitjee
<?php

error_reporting(E_ALL);
set_time_limit(1000000);
include "Snoopy.class.php";
$file = file('ashwini.htm');
$snoopy = new snoopy();
$snoopy->agent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";
$snoopy->rawheaders["Pragma"] = "no-cache";
$centers_per_zone = array(19, 16, 14, 12, 26, 22, 22);
//Starts from 1
$db = new mysqli("localhost", "root", "nemoabhay", "iitjee");
$count = count($file);
foreach ($file as $ln => $line) {
    $reg_no = trim(substr($line, 0, 7));
    if (ctype_digit($reg_no)) {
        $result_mini = $db->query("SELECT data from results_2011_raw where regno = '{$reg_no}'");
        if ($result_mini) {
            if ($result_mini->num_rows > 0) {
                $data = $result_mini->fetch_row();
                if (strlen($data[0])) {
                    continue;
                }
            }
        }
        echo $ln . "/" . $count . "\r";
        $form['regno'] = $reg_no;
        $form['submit'] = "Submit";
        $snoopy->submit("http://192.168.216.1/resultstatus.php", $form);
        if (strpos($snoopy->results, 'is invalid') !== false) {
            echo "Invalid.";
コード例 #18
0
ファイル: push.php プロジェクト: 0hyeah/yurivn
    $msgargs = array(base64_encode(prepare_utf8_string($vbulletin->options['bbtitle'])));
    $pmpart = 0;
    if ($haspm) {
        if (count($pms) > 1) {
            $msgargs[] = base64_encode(count($pms));
            $pmpart = 2;
        } else {
            $first_pm = array_shift($pms);
            $msgargs[] = base64_encode(prepare_utf8_string($first_pm['fromusername']));
            $pmpart = 1;
        }
    }
    $subpart = 0;
    if ($hassub) {
        if (count($subs) > 1) {
            $msgargs[] = base64_encode(count($subs));
            $subpart = 2;
        } else {
            $first_sub = array_shift($subs);
            $msgargs[] = base64_encode(prepare_utf8_string($first_sub['title']));
            $subpart = 1;
        }
    }
    $out_msg[] = array('u' => $user['fr_username'], 'b' => $user['b'], 'pm' => $haspm, 'subs' => $hassub, 'm' => "__FR_PUSH_{$pmpart}PM_{$subpart}SUB", 'a' => $msgargs, 't' => $total);
}
// Send our update to Forum Runner central push server.  Silently fail if
// necessary.
if (count($out_msg) > 0) {
    $snoopy = new snoopy();
    $snoopy->submit('http://push.forumrunner.com/push.php', array('k' => $mykey, 'm' => serialize($out_msg), 'v' => $fr_version, 'p' => $fr_platform));
}
コード例 #19
0
ファイル: block.php プロジェクト: chenyongze/iwebshop
 /**
  * 快递单
  * */
 function exdelivry()
 {
     $id = IReq::get('id');
     $tb_delivery_doc = new IQuery('delivery_doc as dd');
     $tb_delivery_doc->fields = 'd.name,dd.delivery_code,fc.freight_name';
     $tb_delivery_doc->where = 'order_id=' . $id;
     $tb_delivery_doc->join = 'left join delivery as d on dd.delivery_type=d.id left join freight_company as fc on d.freight_id=fc.id';
     $delivery_info = $tb_delivery_doc->find();
     $get_content = '暂无相关信息!';
     if (count($delivery_info) > 0) {
         //获得用户申请的id
         $config = new Config("site_config");
         $config_info = $config->getInfo();
         $express_key = isset($config_info['express_key']) ? $config_info['express_key'] : '';
         if ($express_key) {
             //获得物流名称和物流单号
             $delivery_code = $delivery_info[0]['delivery_code'];
             $name = $delivery_info[0]['freight_name'];
             $get_content = '物流公司或者货运单号错误';
             $type = '1';
             if ($delivery_code != '' && $name != '') {
                 $name = str_replace(' ', '', $name);
                 $delivery_code = str_replace(' ', '', $delivery_code);
                 $sUrl = $this->module->getBasePath();
                 include $sUrl . 'plugins/freight/company.php';
                 $company = new Company();
                 $name = $company->getCompany($name);
                 $AppKey = $express_key;
                 $url = 'http://api.kuaidi100.com/api?id=' . $AppKey . '&com=' . $name . '&nu=' . $delivery_code . '&show=2&muti=1&order=asc';
                 //请勿删除变量$powered 的信息,否者本站将不再为你提供快递接口服务。
                 $powered = '查询数据由:<a href="http://kuaidi100.com" target="_blank">KuaiDi100.Com (快递100)</a> 网站提供 ';
                 //优先使用curl模式发送数据
                 if (function_exists('curl_init') == 1) {
                     $curl = curl_init();
                     curl_setopt($curl, CURLOPT_URL, $url);
                     curl_setopt($curl, CURLOPT_HEADER, 0);
                     curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
                     curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
                     curl_setopt($curl, CURLOPT_TIMEOUT, 5);
                     $get_content = curl_exec($curl);
                     $type = '2';
                     curl_close($curl);
                 } else {
                     include $sUrl . 'plugins/freight/snoopy.php';
                     $snoopy = new snoopy();
                     $snoopy->referer = 'http://www.google.com/';
                     //伪装来源
                     $snoopy->fetch($url);
                     $get_content = $snoopy->results;
                     $type = '2';
                 }
             }
         } else {
             $get_content = '您还没有申请ID,请到<a href="http://kuaidi100.com" target="_blank">KuaiDi100.Com (快递100)</a>申请!';
         }
     }
     $this->setRenderData(array('conent' => $get_content, 'type' => $type));
     $this->redirect('exdelivry');
 }
コード例 #20
0
ファイル: jee3.php プロジェクト: shashi12533/iitjee
<?php

error_reporting(E_ALL);
set_time_limit(1000000);
include "Snoopy.class.php";
$snoopy = new snoopy();
$snoopy->agent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.4) Gecko/20100611 Firefox/3.6.4 (.NET CLR 3.5.30729)";
$snoopy->rawheaders["Pragma"] = "no-cache";
//$link='http://jee.iitm.ac.in/counseling/marks/iitd/index.php';
$db = mysqli_connect('localhost', 'captnemo_user', 'password', 'captnemo_db');
if (!$db) {
    die("death");
}
$q = "SELECT * FROM results where cat='GE' AND catrank='0' AND course <> 'Not Allotted' order by rank desc";
$res = mysqli_query($db, $q);
//echo "<table>";
while ($row = mysqli_fetch_row($res)) {
    $form['regno'] = $row[0];
    //.substr(str_replace(" ","",trim($row[1])),0,4);
    //$form['Form_No']=
    $ff = $row[0];
    $form['submit'] = 'Submit';
    //echo $form['Form_No']."<BR>";
    $link = "http://jee.iitm.ac.in/resultstatus.php";
    $snoopy->submit($link, $form);
    //var_dump($snoopy->cookies);
    //echo $snoopy->lastredirectaddr."<BR>";
    // $header=$snoopy->headers;
    // $ck['PHPSESSID']=cut_str($header[4],"=",";");
    //echo $ck."<BR>";
    //echo $snoopy->results;