public function doBroker($request, $response)
	{
		$remoter = new RequestDelegate();
		if ($request->url)
		{
			$url = $request->url;
		}
		elseif ($request->to)
		{
			$url = $request->to;
		}
		elseif ($request->text)
		{
			$url = $request->text;
		}
		else
		{
			$url = null;
		}
		
		if ($url)
		{
			$result = $_SERVER['REQUEST_METHOD'] == 'POST' ?
				$remoter->request($url, 'post', $request->getAllSafePost()) : 
				$remoter->request($url);
			
			echo mb_convert_encoding($result, 'utf-8', 'gbk');
		}
		else
		{
			echo "error";
		}
		return parent::DIRECT_OUTPUT;
	}
Ejemplo n.º 2
0
    public function broker($request, $response)
    {/*{{{*/
		$url = $res = null;
		if (isset($_REQUEST['url']) && !empty($_REQUEST['url'])) {
            $url = urldecode($_REQUEST['url']);
		} elseif (isset($_REQUEST['to']) && !empty($_REQUEST['to'])) {
            $url = urldecode($_REQUEST['to']);
		} elseif (isset($_REQUEST['text']) && !empty($_REQUEST['text'])) {
			$res = urldecode($_REQUEST['text']);
		} else {
			$res = 'error';
		}
        if ($url) {
            $cookie = isset($_SERVER['HTTP_COOKIE'])?$_SERVER['HTTP_COOKIE']:'';
            //增加post方法
            if (0 < strpos($url, '?'))
				$separator = '&';
			else
				$separator = '?';
            $request = new Request();
			$params = http_build_query($request->getAllSafePost());
			$url = $url.$separator.$params;
			$remoter = new RequestDelegate();
            $res = $remoter->request($url, 'get', array(), $cookie, 5);
        }
        header('Content-Type: text/html; charset=GBK');
        echo $res;
        exit;
	}/*}}}*/
Ejemplo n.º 3
0
<?php

$base = dirname(__FILE__);
require $base . '/../assembly.php';
@header('Content-Type: text/html; charset=gbk');
$tmpRequest = new Request();
$url = $tmpRequest->url;
$text = $tmpRequest->text;
if (!empty($url)) {
    if (0 < strpos($url, '?')) {
        $separator = '&';
    } else {
        $separator = '?';
    }
    $request = new Request();
    $params = http_build_query($request->getAllSafePost());
    //echo Lib_CrossDomainAgent::getUrl(urldecode($url.$separator.$params));
    $url = urldecode($url . $separator . $params);
    $remoter = new RequestDelegate();
    $cookie = isset($_SERVER['HTTP_COOKIE']) ? $_SERVER['HTTP_COOKIE'] : '';
    echo $remoter->request($url, 'get', array(), $cookie, 5);
    //public function request($hosts, $method='get', $args=array(), $cookie='', $timeout=self::TIME_OUT, $noRetry=false, $host='')
} elseif (!empty($text)) {
    echo urldecode($text);
} else {
    echo 'error';
}
Ejemplo n.º 4
0
<?php
require('init.php');

@header('Content-Type: text/html; charset=gbk');
$tmpRequest = new Request();
$url = $tmpRequest->url;
$text = $tmpRequest->text;
if (!empty($url)) 
{
	$remoter = new RequestDelegate();
	$cookie = isset($_SERVER['HTTP_COOKIE'])?$_SERVER['HTTP_COOKIE']:'';

    $method = 'post';
    if ('GET' == $_SERVER['REQUEST_METHOD'])
    {
        $method = 'get';
    }
    $request = new Request();
    echo $remoter->request($url, $method, $request->getAllSafePost(), $cookie, 5);
}
elseif (!empty($text)) 
{
	echo urldecode($text);
}
else 
{
	echo 'error';
}
Ejemplo n.º 5
0
if ('' == $exception_sys && '' == $exception_db)
{
	exit;
}

//require('/home/tester/php/libs/framework/util/remoter.php');
require('remoter.php');
require('xstring.php');
//public function request($hosts, $method='get', $args=array(), $cookie='', $timeout=self::TIME_OUT, $noRetry=false, $host='')
$r = new RequestDelegate();
$cookie = 'Bugzilla_login=6; Bugzilla_logincookie=F7nDtJe2pq; TUI=expert_fields=1';

//提一个新的bug
$args = array('product' => '意见汇总');
$getArgs = XString::convertEncoding($args, 'utf-8', 'gbk');
$getContent = $r->request('http://192.168.1.99/enter_bug.cgi', 'get', $getArgs, $cookie, 10, true, 'bug.haodf.com');
//sleep(1);

//提交bugform
$args = array();
$args['short_desc'] = '[自动提交]线上程序异常';
$args['comment'] = "exception_sys: ".strlen($exception_sys)."\r\n\r\nexception_db: ".strlen($exception_db)."\r\n\r\n努力改吧";

$args['product'] = '意见汇总';
$args['token'] = getToken($getContent);
$args['component'] = '意见汇总';
$args['version'] = '未指定';
$args['bug_severity'] = 'normal';
$args['rep_platform'] = 'PC';
$args['op_sys'] = 'Windows';
$args['priority'] = 'P1';
Ejemplo n.º 6
0
 public function testloginin($request, $response)
 {
     /*{{{*/
     $userName = '******';
     $password = '******';
     $remoter = new RequestDelegate();
     $url = "http://" . URL_PREFIX . "mobile-api.haodf.com/mobileapi/authUser";
     $userName = mb_convert_encoding($userName, 'utf-8', 'gbk');
     $cryptedData = $this->cryptWithKey(json_encode(array("userName" => $userName, 'password' => $password, 'requestTime' => time())), "fa28bd37cd7f397fbd088649c1d09af8");
     $args = array('os' => 'android', 'app' => 'followup', 'version' => 'fu1.0', '_s' => $cryptedData);
     $res = $remoter->request($url, 'post', $args);
     $res = json_decode($res);
     var_dump($this->decryptWithKey($res->content->_s, "fa28bd37cd7f397fbd088649c1d09af8"));
     exit;
 }