I have problem with this code:

```
function get_request($url,$header_array){

        $curl = curl_init();
        curl_setopt_array($curl, array(
          CURLOPT_URL => $url,
          CURLOPT_RETURNTRANSFER => true,
          CURLOPT_ENCODING => "",
          CURLOPT_MAXREDIRS => 10,
          CURLOPT_TIMEOUT => 30,
          CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
          CURLOPT_CUSTOMREQUEST => "GET",
          CURLOPT_HTTPHEADER => $header_array,
        ));

        $response = curl_exec($curl);
        $err = curl_error($curl);

        curl_close($curl);

        if ($err) {
          echo "cURL Error #:" . $err;
        } else {
          return $response;
        }

    }

```

I've got this error:

```
cURL Error #:Could not resolve host:

```

I know there are a lot of questions like this, but the answer from those questions didn't help me, because its different code. Does anyone can help me how to fix this error:
['https://Stackoverflow.com/questions/59125318', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']
There's a few things this could be; and generally its either a malformed URL or a networking issue outside the scope of cURL.

First, save yourself some time and just double and triple check you've typed the URL correctly. I do this time and time again =D

Next up, on the same machine and under the same user as your PHP code executes, run something like `curl -sS http://yoururl.com/example` from the command line. This will help you double check your code can actually make outbound HTTP requests.

If your curl command fails in bash, then you can look at a few causes depending on the errors:

* a networking issue (has your local/dev machine lost internet connectivity?)
* a firewall issue; is your firewall configured to allow inbound HTTP(s) and not outbound?
* is it a DNS issue (my favourite!). If the domain is new, perhaps it hasn't proposed to your server's upstream DNS yet.

At this point, your question turns from curl to networking and DNS so I don't dive deeper into debugging... but this is, at least, where I'd start in looking into your error message.
reading the symptoms, it is possible the DNS resolver that you use is probably too busy (timeout) -or- limit the number of inquiry per IP address in a certain timespan. So, the same exact process will probably give a different error if run on a different day.