Set proxy in Guzzle

后端 未结 6 480
广开言路
广开言路 2021-01-11 13:06

I have a problem with set proxy in guzzle that a blank page was shown while with curl everything works perfect. The code that I used in guzzle and curl came below. What is w

6条回答
  •  被撕碎了的回忆
    2021-01-11 13:56

    for a proxy, if you have the username and password, you can use:

    $client = new GuzzleHttp\Client();
    
    $res = $client->request("POST", "https://endpoint.com", [
        "proxy" => "http://username:password@192.168.16.1:10",
    ]);
    

    this worked with guzzle in php.

提交回复
热议问题