Set proxy in Guzzle

后端 未结 6 529
广开言路
广开言路 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 14:00

    $response = \Drupal::httpClient()->post($settings['base_url'] . 'api/search/', [
        'verify' => true,
        'body' => $post_data,
          'headers' => [
            'Content-type' => 'application/json',
          ],
        'curl' => [
            CURLOPT_SSLVERSION => CURL_SSLVERSION_TLSv1_2, 
            CURLOPT_PROXY => 'proxyip:58080'],
        ]
      )->getBody()->getContents();
    

    Set proxy/https in Guzzle and SSL its work perfect.

提交回复
热议问题