I am trying to send a SMS through script. I am using curl to run the API sending the SMS on the vendor server. fopen and file_get_contents are blocked on my server. So, cURL is
This is hard to say, but I would recommend adding CURLOPT_CONNECTTIMEOUT
in addition to CURLOPT_TIMEOUT
to your curl options. I am setting CURLOPT_CONNECTTIMEOUT
to 5
in this example. And set CURLOPT_HTTPGET
to TRUE
. Also, adding CURLOPT_USERAGENT
as well just in case the remote server needs something as a user agent:
// Compose query
$options = array(
CURLOPT_URL => $adb_url.$uri."?".$query,
CURLOPT_CUSTOMREQUEST => $method, // GET POST PUT PATCH DELETE HEAD OPTIONS
CURLOPT_POSTFIELDS => $json,
CURLOPT_PORT => 8080,
CURLOPT_HTTPGET => TRUE,
CURLOPT_CONNECTTIMEOUT => 5,
CURLOPT_USERAGENT => "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)",
CURLOPT_HTTPHEADER => Array('Content-type: text/plain')
);
curl_setopt_array($adb_handle,($options + $adb_option_defaults));
Also, unclear if the PHP version on your local setup is the same as the server.