예제 #1
0
<?php

/**
 * 获取订单列表
 *
 * Author: yosolin
 * Date: 2016/01/13
 */
require_once "config.php";
require_once "functions.php";
require_once "header.php";
// api url与method
$http_url = "https://sandbox-tradeopen.futu5.com/orders";
// 生产环境去掉 'sandbox-'
$http_method = "GET";
// http请求body
$http_body = array();
// 生成http请求头部
$http_header = make_header($http_body, $http_url, $http_method, false, 'tc');
// http请求
$ret = ssl_curl($http_url, $http_method, $http_header, $http_body, Config::$ssl_cert, Config::$ssl_key);
echo $ret;
 is_page($page);
 preg_match('%ocation: (.+)\\r\\n%', $page, $redir);
 $geturl = rtrim($redir["1"]);
 $geturl = "{$geturl}&locale=en";
 $page = ssl_curl($geturl, 0, $cookie);
 $cookies = GetCookies($page);
 $post_path = cut_str($page, '<form id="fm1" class="fm-v clearfix" action="', '" method="post">');
 $post_url = "https://id.megaplus.vn";
 $post_url = "{$post_url}{$post_path}";
 $post = array();
 $post['username'] = trim($_REQUEST['my_login']);
 $post['password'] = trim($_REQUEST['my_pass']);
 $post['lt'] = cut_str($page, '<input type="hidden" name="lt" value="', '" />');
 $post['_eventId'] = 'submit';
 $post['submit'] = 'LOGIN';
 $page = ssl_curl($post_url, $post, $cookies);
 $cookies = GetCookies($page);
 preg_match('%ocation: (.+)\\r\\n%', $page, $redir);
 $geturl = rtrim($redir["1"]);
 if (!$geturl) {
     is_notpresent($page, 'ticket=', 'Error logging in - are your logins correct!');
 }
 $Url = parse_url($geturl);
 $page = geturl($Url["host"], $Url["port"] ? $Url["port"] : 80, $Url["path"] . ($Url["query"] ? "?" . $Url["query"] : ""), 0, $cookies, 0, 0, $_GET["proxy"], $pauth);
 is_page($page);
 $cookie = GetCookies($page);
 $cookies = substr($cookie, 37);
 $Url = parse_url("http://share.megaplus.vn/index.php");
 $page = geturl($Url["host"], $Url["port"] ? $Url["port"] : 80, $Url["path"] . ($Url["query"] ? "?" . $Url["query"] : ""), "http://share.megaplus.vn/", $cookies, 0, 0, $_GET["proxy"], $pauth);
 is_page($page);
 $PHPSESSID = str_replace('PHPSESSID=', '', $cookies);