PHP Curl does not work on localhost?

前端 未结 6 1567
既然无缘
既然无缘 2020-12-15 19:35

I am using MAMP Pro 1.9.4 on Mac OSX
In phpinfo() I see curl is enabled

cURL support    enabled
cURL Information    7.20.0
Age 3
Features
         


        
6条回答
  •  长情又很酷
    2020-12-15 20:04

    If you are behind a proxy, you could try adding CURLOPT_PROXY, for example (assuming your proxy is on 192.168.1.2 port 3128):

    $ch = curl_init($geocodeURL);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_PROXY, "192.168.1.2:3128");
    $result = curl_exec($ch);
    

    Hope this helps.

提交回复
热议问题