Example #1
0
function create_id($rule_name, $app_name, $salt = '')
{
    $request = array("action" => "create", "rule_name" => $rule_name, "app_name" => $app_name, "salt" => $salt);
    $response = do_request($request);
    //var_dump($response) ;
    $new_id = is_array($response) ? $response["data"] : "";
    return $new_id;
}
Example #2
0
 public function actionPushMobile()
 {
     $url = 'http://app.iheima.com/?app=member&controller=userdatacenter&action=mobile_datacenter';
     $token = $this->getToken();
     $openId = 'c992bc3ee6e7631b9bf7d4135f68ccbc';
     $mobile = '13788888881';
     $data = ['mobile' => $mobile, 'open_id' => $openId, 'access_token' => $token];
     $rs = do_request($url, $data);
     var_dump($rs);
 }
Example #3
0
 /**
  * 获取AccessToken
  *
  * @param array $config
  * @return string
  */
 private function _getToken($config)
 {
     if (!isset($config['auth']['app_id']) || !isset($config['auth']['app_secret']) || !isset($config['api']['domain']) || !isset($config['api']['access_token'])) {
         return null;
     }
     $auth = Yii::$app->util->encrypt($config['auth']['app_id'], $config['auth']['app_secret']);
     $url = $config['api']['domain'] . '/?' . $config['api']['access_token'] . '&auth=' . rawurlencode($auth) . '&app_secret=' . rawurlencode($config['auth']['app_secret']);
     $resp = do_request($url);
     return $resp;
 }
Example #4
0
function test_client()
{
    do_request();
    do_request();
    do_request();
}
Example #5
0
}
// Split feed name and region.
list($module, $FeedName, $region) = explode('_', $FeedName);
$FeedName = $module . '_' . $FeedName;
// Select the proper Amazon MWS URL.
if ($region == 'ca') {
    $serviceUrl = "https://mws.amazonservices.ca";
} else {
    $serviceUrl = "https://mws.amazonservices.com";
}
// Create service that connects to the Amazon MWS.
$config = array('ServiceURL' => $serviceUrl, 'ProxyHost' => null, 'ProxyPort' => -1, 'MaxErrorRetry' => 3);
$service = new MarketplaceWebService_Client($Creds['access_key'], $Creds['secret_key'], $config, 'IntenseCart Amazon Plugin Installer', '1.0');
// Request the initial inventory report, if it hasn't been done.
if (!is_file(CACHE_REQ_FILE . $region) && !is_file(CACHE_REP_FILE . $region)) {
    do_request($service, $region, $Creds);
}
// Wait for the Amazon reports to be generated, and parse them.
if (is_file(CACHE_REQ_FILE . $region)) {
    $runtime = do_report($service, $region, $Creds);
    // Show "waiting" page.
    write_waiting($runtime);
    die;
}
// Show and parse the matching form for products.
if (is_file(CACHE_REP_FILE . $region)) {
    echo do_match($region);
    die;
}
/**
 * Shows and parses the product matching form.
Example #6
0
function test_client($scheme, $port)
{
    $clientcontext = null;
    if ($scheme != "tcp") {
        $clientcontext = stream_context_create();
        stream_context_set_option($clientcontext, 'ssl', 'allow_self_signed', true);
        stream_context_set_option($clientcontext, 'ssl', 'verify_peer', false);
    }
    do_request($scheme, $port, $clientcontext);
    do_request($scheme, $port, $clientcontext);
    do_request($scheme, $port, $clientcontext);
}
Example #7
0
    }
} else {
    if (strlen($command) > 0) {
        $log .= "Command: {$command}, ";
        $headers = "Content-Length: 0\n";
    } else {
        $command = "key";
        $pre_get = microtime();
        if (strlen($path) > 1) {
            $data = file_get_contents("{$path}");
            $log .= "PNG Path: {$path}, ";
        }
        if (!$data) {
            $data = file_get_contents("assets/blank.png");
            $log .= "ERROR: Couldn't load title; clearing existing title";
        }
        $post_get = microtime();
    }
}
$server_url = $server == 'animator' ? $animator_url : $keyer_url;
$pre_post = microtime();
$result = do_request($method, $server_url . "{$command}", $data, $log, $headers);
$post_post = microtime();
// re-write timing at some point
$time_end = microtime();
$post_time = sprintf("%.3f", $post_post - $pre_post);
$get_time = sprintf("%.3f", $post_get - $pre_get);
$total_time = sprintf("%.3f", $time_end - $time_start);
$log .= "Total: {$total_time},  Get: {$get_time} , Post: {$post_time}. <br>";
echo $log;
//echo("<hr>");
 * called with: mv_flvServer.php?file=myClip.flv&t=0:01:00/0:02:00
 *
 * flash does not like get arguments in media files? so best to use mod-rewrite
 * something like:
 * /flvserver/my_file/start_time/end_time
 */
define('BASE_LOCAL_CLIP_PATH', '/metavid/video_archive');
//define('BASE_LOCAL_CLIP_PATH', '/tmp');
define('WEB_CLIP_PATH', '/flv_cips');
define('FLASH_VIDEO_CONTENT_TYPE', 'video/x-flv');
define('AUDIO_FRAME_INTERVAL', 3);
//what to append to the flv file name to store serialized meta tags:
if (!function_exists('filter_input')) {
    die('you version of php lacks <b>filter_input()</b> function</br>');
}
do_request();
function do_request()
{
    $file_req = filter_input(INPUT_GET, 'file', FILTER_SANITIZE_STRING);
    $time_req = filter_input(INPUT_GET, 't', FILTER_SANITIZE_STRING);
    //try to grab the file from /filename format
    if ($file_req == '') {
        if (isset($_SERVER['PHP_SELF'])) {
            $pathparts = explode('/', $_SERVER['PHP_SELF']);
            $file_req = strpos($pathparts[count($pathparts) - 1], '?') !== false ? substr($pathparts[count($pathparts) - 1], 0, strpos($pathparts[count($pathparts) - 1], '?')) : $pathparts[count($pathparts) - 1];
        }
    }
    //additional filtering to avoid directory traversing:
    $file_req = str_replace(array('../', './'), '', $file_req);
    if ($file_req == '') {
        die('error: missing file name');