码迷,mamicode.com
首页 > Web开发 > 详细

php guzzle post async

时间:2017-08-13 00:20:46      阅读:486      评论:0      收藏:0      [点我收藏+]

标签:name   rom   cep   weight   int   completed   poc   func   ken   



use GuzzleHttp\Pool;
use GuzzleHttp\Client;
//use GuzzleHttp\Psr7\Request;
use Psr\Http\Message\ResponseInterface;
use GuzzleHttp\Exception\RequestException;

$param = array(
‘order_id‘ => $orderId,
‘type‘ => 0,
‘amount‘ => ($re->Amount - $re->Tax) / 100,
‘fullname‘ => $u->BindAlipayName,
‘account‘ => $u->BindAlipay,
‘callback_url‘ => ‘http://yuexingy.top/Withdraw/WithdrawCallback.aspx‘,
‘device_type‘ => $re->DeviceType,
‘device_id‘ => $re->DeviceID,
‘device_ip‘ => $re->DeviceIP,
);

$json = json_encode($param);
$sign = md5($json . time() . "a3fae542929247e9ada6c182cbe57756");
Log::info(‘sign:‘ . $sign);
Log::info(‘$json:‘ . $json);

$data = array(‘json‘=>$json);
//$data = [‘form_params‘=>$param];
//$data = [‘json‘=>$param];
//$data = [‘_token‘=>‘FOkSQwyE9spYsYehn12hxqactJ4fPOCSLsZx4tEf‘, ‘ids‘=>‘995232‘];
$url = ‘http://yuexingy.top:5100/withdraw/withdraw.php‘;



// 发送一个异步请求
$req = new \GuzzleHttp\Psr7\Request(‘POST‘, ‘http://yuexingy.top:5100/withdraw/withdraw.php‘, $data);
$promise = $client->sendAsync($req)->then(function ($response) {
Log::info(‘I completed! ‘ . $response->getBody());
});
$promise->wait();

php guzzle post async

标签:name   rom   cep   weight   int   completed   poc   func   ken   

原文地址:http://www.cnblogs.com/yuanxiaoping_21cn_com/p/7351850.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!