コード例 #1
0
 public function loginAction()
 {
     $this->view->disable();
     $http_request = new HttpRequest();
     print_r($_SERVER);
     $header = array('Host:106.37.195.128', 'User-Agent:Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:40.0) Gecko/20100101 Firefox/40.0', 'Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Language:zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3', 'Referer:http://106.37.195.128/chinalifepcsfa/system/userLogin.do', 'Connection:keep-alive');
     $data = 'platformType=0&userId=530123197902182620&password=sp182620';
     $http_respone = $http_request->post('http://106.37.195.128/chinalifepcsfa/system/userLogin.do', $header, $data);
     if (isset($http_respone->headers['Location'])) {
         $location = $http_respone->headers['Location'];
         $cookies = $http_respone->cookies;
         $header2 = array('Host:106.37.195.128', 'User-Agent:Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:40.0) Gecko/20100101 Firefox/40.0', 'Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Language:zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3', 'Referer:http://106.37.195.128/chinalifepcsfa/system/userLogin.do', 'Connection:keep-alive');
         $http_respone2 = $http_request->get($location, $header2, $cookies);
         preg_match('@href="(/chinalifepcsfa/user/electronicInsurance.do\\?.*)"@Ui', $http_respone2->content, $matches);
         $entrance_href = 'http://106.37.195.128' . $matches[1];
         $header3 = array('Host:106.37.195.128', 'User-Agent:Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:40.0) Gecko/20100101 Firefox/40.0', 'Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Language:zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3', 'Connection:keep-alive');
         $http_respone3 = $http_request->get($entrance_href, $header3, $cookies);
         $final_url = $http_respone3->headers['Location'];
         $_SESSION['emu_url'] = $final_url;
         $final_header = array('Host:106.37.195.128:7011', 'User-Agent:Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:40.0) Gecko/20100101 Firefox/40.0', 'Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Language:zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3', 'Connection:keep-alive');
         $final_http_response = $http_request->get($final_url, $final_header, $cookies);
         $_SESSION['emu_cookies'] = $final_http_response->cookies;
     } else {
         echo json_encode(array('success' => false, 'err_msg' => '用户名或密码错误!'));
     }
 }
コード例 #2
0
	/**
	 * 验证通过后运行数据层
	 */
	protected static function _run()
	{
		$actionName = SuiShiPHPConfig::getAction();
		$method = SuiShiPHPConfig::getMethod();

		define("__ACTION_NAME__", $actionName);
		define("__ACTION_METHOD__", $method);
		define("__APP_GROUP__", SuiShiPHPConfig::getAppGroup());

		if (SuiShiPHPConfig::getAppGroup()) {
			$actionName = SuiShiPHPConfig::getAppGroup() . '.' . $actionName;
		}
		$action = loadAction($actionName);
		
		if (! $action || ! method_exists($action, $method)) {
			if (SuiShiPHPConfig::get('DEBUGGING') === true) {
				Logger::error('_run error: action not exist, action: '.__ACTION_NAME__.', method: '.__ACTION_METHOD__,
				HttpRequest::get());
				throw new Exception('action not exist, action: '.__ACTION_NAME__.', method: '.__ACTION_METHOD__);
			} else {
				Logger::error('_run error: action not exist, action: '.__ACTION_NAME__.', method: '.__ACTION_METHOD__,
				HttpRequest::get());
				myExit(); //TODO () 转向到404 页面
			}
		}
		
		$action->$method(HttpRequest::get());
	}
コード例 #3
0
 public function index()
 {
     $http_request = new HttpRequest();
     $http_response = $http_request->get('www.sina.com');
     $http_response->headers;
     $user = UserModel::findUserById('*****@*****.**');
     $this->view->setVars(array('headers' => $http_response->headers, 'content' => htmlspecialchars($http_response->content), 'user' => $user));
 }
コード例 #4
0
ファイル: tubuInvit.php プロジェクト: xuyintao/thindev
 public function add()
 {
     //Id,Name,Phone,CreateTime
     $res = array();
     $time = time();
     //验证会员接口
     $type = 1;
     $value = $this->Phone;
     $client_token = md5(CLIENT_ID . CLIENT_SECRET . $time);
     $url = 'http://wx.thindo.com/api/member/isMember.php?mid=' . BELONG . '&client_id=' . CLIENT_ID . '&client_token=' . $client_token . '&time=' . $time . '&type=' . $type . '&value=' . $value;
     $httpRequest = new HttpRequest(true, false);
     $reMes = $httpRequest->get($url);
     $isMember = $reMes->Success;
     if (!$isMember) {
         $res['Success'] = false;
         $res['IsMember'] = false;
         $res['Message'] = "您不是博观表行Fun会员";
         echo json_encode($res);
         exit;
     }
     //添加用户操作
     $obj = new TubuInvit();
     $obj->Name = $this->Name;
     $obj->Phone = $this->Phone;
     $obj->CreateTime = date('Y-m-d H:i:s', $time);
     $result = $obj->add();
     //对返回的三种结果进行分类
     if ($result > 0) {
         $res['Success'] = true;
         $res['IsMember'] = true;
         $res['Message'] = "恭喜你,报名成功";
     } else {
         if ($result == -1) {
             $res['Success'] = false;
             $res['IsMember'] = true;
             $res['ApplyOnce'] = true;
             $res['Message'] = "此手机号已申请过";
         } else {
             $res['Success'] = false;
             $res['IsMember'] = true;
             $res['Message'] = "系统繁忙";
         }
     }
     echo json_encode($res);
     exit;
 }
コード例 #5
0
ファイル: start.php プロジェクト: xuyintao/thindev
     $httpRequest = new HttpRequest(true, false);
     $userinfo = $httpRequest->get($url_sns_userinfo);
     $_SESSION[$sessionkey_nickname] = $userinfo->nickname;
     $_SESSION[$sessionkey_photo] = str_replace('/0', '/64', $userinfo->headimgurl);
     header("location:" . $actUrl);
     exit;
 } else {
     if ($type == "getBasicUserInfo") {
         $j = 0;
         a:
         //获取的基础access_token
         $time = time();
         $client_token = md5(CLIENT_ID . CLIENT_SECRET . $time);
         $url_access_token = 'http://wx.thindo.com/api/getAccessToken.php?mid=' . BELONG . '&client_id=' . CLIENT_ID . '&client_token=' . $client_token . '&time=' . $time;
         $httpRequest = new HttpRequest(true, false);
         $reMes = $httpRequest->get($url_access_token);
         $access_token = $reMes->AccessToken;
         //echo $access_token."2";
         $res = null;
         $reMes = null;
         //echo $openid;
         $url_userinfo = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=" . $access_token . "&openid=" . $openid . "&lang=zh_CN";
         $userinfo = $httpRequest->get($url_userinfo);
         if (!isset($userinfo->subscribe) && $j < 3) {
             //echo $j;
             $j++;
             sleep(3);
             goto a;
         }
         if ($userinfo->subscribe == "1") {
             //已经关注,记录openid,并跳转
コード例 #6
0
ファイル: Init.php プロジェクト: neil-chen/NeilChen
<?php
set_time_limit(0);
define("LIB_PATH", dirname(__FILE__));
define("APP_NAME", 'HuiShi');
error_reporting(E_ALL);
ini_set("display_errors", true);
date_default_timezone_set('PRC');

include_once LIB_PATH . '/../../SuiShiPHP/SuiShiPHP.class.php';
include_once LIB_PATH . '/../../SuiShiPHP/Log/SystemLog.class.php';
include_once LIB_PATH . '/../../SuiShiPHP/Cache/RedisCache.class.php';
include_once LIB_PATH . '/Common/String.class.php';
include_once LIB_PATH . '/Config/Config.php';
//include_once LIB_PATH . '/Config/Define.Config.php';
include_once LIB_PATH . '/Common/Function.php';
include_once LIB_PATH . '/Common/Page.class.php';
include_once LIB_PATH . '/Common/Image.class.php';

SuiShiPHP::init(Config::$_CONFIGS);

Factory::getSystemLog()->start();
Factory::getSystemLog()->push("http param", HttpRequest::get());
コード例 #7
0
ファイル: test.php プロジェクト: xuyintao/thindev
/*phpinfo();
return;*/
require __DIR__ . '/autoload.php';
$kv = new KVDB();
$kv->set("name", "sauwe");
$kv->delete("name");
echo $kv->get("name");
return;
$mmcache = new MMCache();
//$mmcache->delete("key");
//$mmcache->set("key","问少尉",600);
echo $mmcache->get("key");
return;
$imgurl = 'http://localhost:86/temporary/test.jpg';
$request = new HttpRequest(false, false);
$img_data = $request->get($imgurl);
$img = new Image();
$img->setData($img_data);
//$img->resize(300); // 等比缩放到200宽
$img->annotate("翁少尉1", 0.5, GRAVITY_SOUTHEAST, array("name" => FONT_MicroHei, "size" => 100, "color" => "red"));
$new_data = $img->exec();
// 执行处理并返回处理后的二进制数据
$ftype = "jpg";
$stor = new Storage();
$picurlm = $stor->write(FILE_DIR_TEMP, "_400." . $ftype, $new_data);
return;
$stor = new Storage();
$picurl = $stor->upload(FILE_DIR_TEMP, $destination, $filename);
return;
$uptypes = array('image/jpg', 'image/jpeg', 'image/png', 'image/pjpeg', 'image/gif', 'image/bmp', 'image/x-png');
コード例 #8
0
ファイル: Action.class.php プロジェクト: neil-chen/NeilChen
	/**
	 * 获取http parameter
	 *
	 * @param string $name http参数key
     * @param bool $htmQuotes 是否转义html
     * @param string $tags 允许保留到标签,all 为去全部
     * @return string | array
	 */
	public function getParam ($name = null, $default = null, $htmQuotes = true, $tags = null)
	{
		return HttpRequest :: get($name, $default, $htmQuotes, $tags);
	}
コード例 #9
0
ファイル: BaseSDK.php プロジェクト: DekingChen/baidu-pusher
 /**
  * 发送一个rest Api 请求
  * @param string $api 请求地址
  * @param array<K,V> $query 请求参数
  * @param string $method 请求方法 目前只支持 GET, POST
  * @param string $header http header
  * @param string $curlOpts curl选项
  * @return mixed 解析结果,如果失败将返回false, 否则应返回解析后的服务端返回的json数据
  */
 protected function sendRequest($api, $query, $method = "POST", $header = null, $curlOpts = null)
 {
     $url = $this->http->getResourceAddress($api);
     $query['sign'] = $this->genSign($method, $url, $query);
     if ($header == null) {
         $header = array('User-Agent: ' . $this->makeUA());
     }
     if ($method == 'GET') {
         $response = $this->http->get($api, $query, $header, $curlOpts);
     } else {
         $response = $this->http->post($api, $query, $header, $curlOpts);
     }
     return $this->parse($response);
 }
コード例 #10
0
ファイル: HttpRequest_test.php プロジェクト: fengyeno/fille
 /**
  * @depends testCreateHttpRequest
  * @param HttpRequest $http
  */
 public function testGet($http)
 {
     $rs = $http->get('httpServer.php', $this->payload);
     $this->valiedResponse($rs);
 }
コード例 #11
0
ファイル: _index.php プロジェクト: jspetrak/raillog
</head>
<body>

<h1>Železniční cestovní zápisník</h1>

<p><a href="cars.php">Statistiky využití vozů</a></p>

<form action="index.php" method="GET">
<fieldset>
<legend>Datové soubory</legend>
<select id="dataFileName" name="dataFileName">
<?php 
foreach (HttpRequest::get()->getDataFileNames() as $dataFileName) {
    ?>
<option <?php 
    if ($dataFileName . '.xml' == HttpRequest::get()->getDataFileName()) {
        echo 'selected="selected"';
    }
    ?>
 value="<?php 
    echo $dataFileName;
    ?>
"><?php 
    echo $dataFileName;
    ?>
</option>
<?php 
}
?>
</select>
 <input type="submit" value="Zobrazit" />
コード例 #12
0
/**
 * Get data from MediaWiki API.
 * *
 * @param string $url Base url for wiki (from LabsDb::getDbInfo).
 * @param array $params Query parameters for MediaWiki API
 * @return object|bool Data from the API response, or boolean false
 */
function kfApiRequest($url, $params)
{
    $section = new kfLogSection(__METHOD__);
    $params['format'] = 'json';
    if (!isset($params['action'])) {
        $params['action'] = 'query';
    }
    $apiUrl = "{$url}/w/api.php?" . http_build_query($params);
    kfLog("request: GET {$apiUrl}");
    $response = HttpRequest::get($apiUrl);
    if (!$response) {
        return false;
    }
    $data = json_decode($response);
    if (!is_object($data) || isset($data->error)) {
        return false;
    }
    return $data;
}
コード例 #13
0
ファイル: FunctionsBase.php プロジェクト: neil-chen/NeilChen
/**
 * 判断是否为ajax请求
 * @return bool
 */
function isAjax () {
	if(isset($_SERVER['HTTP_X_REQUESTED_WITH']) ) {
		if('xmlhttprequest' == strtolower($_SERVER['HTTP_X_REQUESTED_WITH'])) {
			return true;
		}
	}
	if(HttpRequest::get(SuiShiPHPConfig::get('VAR_AJAX_SUBMIT'))) {
		// 判断Ajax方式提交
		return true;
	}
	return false;
}
コード例 #14
0
ファイル: _application.php プロジェクト: jspetrak/raillog
 /**
  *  <p>This is the contructor. It is hidden because is called by running the class.
  *  It creates all necessary instances of other application components.</p>
  */
 private function Application()
 {
     $this->params = HttpRequest::get();
     $this->parser = new XmlDataParser($this->params->getDataFileName());
 }
コード例 #15
0
	/**
	 * 获得实际的模块名称
	 * @access private
	 * @return string
	 */
	static public function getMethod()
	{
		$method = HttpRequest::get(self::METHOD_NAME);
		$method = !empty($method) ? $method : self::get('DEFAULT_METHOD');
		return $method;
	}