Ejemplo n.º 1
0
/**
 * api curl
 * @param $url
 * @param $data
 * @param $method
 * @param $pkg
 * @return mixed
 */
function api_curl($url, $data, $method)
{
    $method = strtoupper($method);
    if ($method == 'GET' && !empty($data)) {
        $url = $url . "?" . http_build_query($data);
        $data = array();
    }
    return curlrequest($url, $data, $method);
}
Ejemplo n.º 2
0
	    <PageSize>10</PageSize> 
	     <RequestCriteria>
	       <Status>0</Status>
	       <Type>0</Type>
	     </RequestCriteria> 
	  </RequestBody></NeweggAPIRequest>';
$data = '{ 
    "OperationType": "GetOrderInfoRequest", 
    "RequestBody": { 
        "PageIndex": "1", 
        "PageSize": "10", 
        "RequestCriteria": { 
            "OrderNumberList": { 
                "OrderNumber": [ 
                    "159243598", 
                    "41473642" 
                ] 
            }, 
            "Status": "1", 
            "Type": "1", 
            "OrderDateFrom": "2011-01-01 09:30:47", 
            "OrderDateTo": "2011-12-17 09:30:47", 
            "OrderDownloaded": 0 
        } 
    } 
} ';
$url = 'http://api.newegg.com/marketplace/ordermgmt/servicestatus?sellerid=' . $SellerID;
echo $url;
$return = curlrequest($url, $data, $header_array, 'GET');
var_dump($return);
exit;
Ejemplo n.º 3
0
function curlrequest($url, $file)
{
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
    curl_setopt($ch, CURLOPT_INFILE, $file);
    curl_setopt($ch, CURLOPT_INFILESIZE, filesize($file));
    $document = curl_exec($ch);
    if (!curl_errno($ch)) {
        $info = curl_getinfo($ch);
        echo 'Took ' . $info['total_time'] . ' seconds to send a request to ' . $info['url'];
    } else {
        echo 'Curl error: ' . curl_error($ch);
    }
    curl_close($ch);
    return $document;
}
$url = "http://127.0.0.1:2380/mdb/";
for ($i = 0; $i = 1000000; $i++) {
    $str = "random data:";
    for ($j = 0; $j < 100; $j++) {
        $str .= rand();
    }
    $file = "/tmp/infile";
    file_put_contents($file, $str);
    $uri = $url . "/" . substr(md5_file($file), 0, 16);
    curlrequest($uri, $file);
    echo "{$uri}\n";
}
Ejemplo n.º 4
0
    //执行预定义的CURL
    if (!curl_errno($ch)) {
        $info = curl_getinfo($ch);
        echo 'Took ' . $info['total_time'] . ' seconds to send a request to ' . $info['url'];
    } else {
        echo 'Curl error: ' . curl_error($ch);
    }
    curl_close($ch);
    return $document;
}
$url = 'http://apitest.cailai.com/v1.1/index.php';
$arr = array('id' => 1, 'name' => 'whh');
$arr = array('5', 'a');
$data = json_encode($arr, JSON_FORCE_OBJECT);
//强制变成对象
$return = curlrequest($url, $data, 'put');
exit;
header("Content-type: text/html; charset=utf-8");
require_once dirname(__FILE__) . '/header.php';
core::Singleton('comm.remote.remote');
//$data = array(
//		'sname' => 'user.isreg',//系统参数,调用接口
//		'mobile' => '13818164082',//应用查参数,快递品牌
//);
//$result = remote::send($data,'',$header);
//print_r(json_decode($result));//打印结果,body属性返回格式为json格式
//////print_r(remote::$debug);
////echo "\n\n";
//exit;
//用户登陆
$data = array('sname' => 'user.login', 'mobile' => '13100030002', 'passwd' => '111111');