zoukankan      html  css  js  c++  java
  • Laravel 5.6 安装 guzzlehttp

    环境:Laravel 5.6

    安装  composer require guzzlehttp/guzzle

    在vendor文件夹下,vendorguzzlehttpguzzle
    引入
    use GuzzleHttpClient;

    官方例子

    $client = new GuzzleHttpClient();
    $res = $client->request('GET', 'https://api.github.com/user', [
        'auth' => ['user', 'pass']
    ]);
    echo $res->getStatusCode();
    // "200"
    echo $res->getHeader('content-type');
    // 'application/json; charset=utf8'
    echo $res->getBody();
    // {"type":"User"...'
    
    // Send an asynchronous request.
    $request = new GuzzleHttpPsr7Request('GET', 'http://httpbin.org');
    $promise = $client->sendAsync($request)->then(function ($response) {
        echo 'I completed! ' . $response->getBody();
    });
    $promise->wait();


    版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zlb25246/article/details/80368789

  • 相关阅读:
    剑指offer——用两个栈实现队列
    根据前序和中序重建二叉树、后序和中序重建二叉树
    归并排序
    排序
    快速排序(java版)
    List
    单链表的基本操作
    集合
    数组
    结构体
  • 原文地址:https://www.cnblogs.com/lxwphp/p/9282751.html
Copyright © 2011-2022 走看看