when I execute a PHP script which runs a cURL request to a .test domain that is setup on my Mac with Laravel Valet/dnsmasq, I get this error printed :
Just spent the last hour on this. I had a similar problem with curl through PHP not resolving with Valet specially for SSL. I tried changing curl-openssl versions and also setting my domain in the host file etc. Nothing worked apart from the following:
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
This is due to the valet SSL not being verified by Curl. Once I added this option to my curl request I was able to fetch data from my local valet url.