zoukankan      html  css  js  c++  java
  • php guzzle post async

    
    
    
    
    use GuzzleHttpPool;
    use GuzzleHttpClient;
    //use GuzzleHttpPsr7Request;
    use PsrHttpMessageResponseInterface;
    use GuzzleHttpExceptionRequestException;

    $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 GuzzleHttpPsr7Request('POST', 'http://yuexingy.top:5100/withdraw/withdraw.php', $data);
    $promise = $client->sendAsync($req)->then(function ($response) {
    Log::info('I completed! ' . $response->getBody());
    });
    $promise->wait();
  • 相关阅读:
    windows服务程序
    DevExpress之时间控件
    DevExpress之列表控件
    Docker安装及基本使用
    配置阿里云yum源
    Centos7安装gitlab
    正则表达式
    sed进阶
    初识sed和gawk
    安装saltstack
  • 原文地址:https://www.cnblogs.com/yuanxiaoping_21cn_com/p/7351850.html
Copyright © 2011-2022 走看看