Even if php curl returns bool (false) https, it will not work.

php curl returns bool (false) to get it locally, but to put it on other servers. What"s the problem? Is
a problem with server configuration?
who knows the great gods?

httpsgetpost



$jiekou="https://www.baifubao.com/callback?cmd=1059&callback=phone&phone=13457854758";
 
 var_dump(https_request($jiekou));







function https_request($url){
  $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_TIMEOUT, 1);
    curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER["HTTP_USER_AGENT"]);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); //
    $r = curl_exec($ch);
    curl_close($ch);
    return $r;


}
Php
Mar.07,2021

curl_error ($ch); read the report


the picture does not come out
but your CURLOPT_TIMEOUT setting is 1 second, maybe your server network is not very good, try setting the timeout to 10 seconds


1.TIMEOUT value is too small
2. It is recommended to add CURLOPT_REFERER
3.USER AGENT not to be extracted from $_ SERVER. It can be modified arbitrarily by the client, or it may not exist. Your purpose is to obtain data from the remote server. It is not necessary to get the USER AGENT, of the client that visits your website every time. Just send a USER AGENT that will not be rejected by the remote server.
4. It's best to define a function before calling it. It's not an error, but it's not a good habit.
5. You can use curl_getInfo () and curl_error () to debug
6. I have changed your code for you.

<?php
    function https_request($url){
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_REFERER, $url);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
        curl_setopt($ch, CURLOPT_TIMEOUT, 10);
        curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36');
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
        $r = curl_exec($ch);
        curl_close($ch);
        return $r;
    }

    $jiekou='https://www.baifubao.com/callback?cmd=1059&callback=phone&phone=13457854758';
     
    var_dump(https_request($jiekou));

?>

Problem with the SSL CA cert (path? Access rights?)

Let the operation and maintenance restart the server

Menu