php guzzle post async



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();
上一篇:[development][semaphore] 信号量/信号灯/信号标/旗语


下一篇:扩展SharePoint链接字段