$api_username,
‘password’ => $api_password,
‘campaignid’ => $campaignid,
‘receiver’ => $phone,
‘text’ => $text,
‘send_sms’ => ‘no’,
);
$ok = false;
if(function_exists(‘http_post_fields’)) {
$result = http_post_fields($api_url, $fields);
$ok = true;
} else {
$result = ‘ERROR: PHP function http_post_fields not found. Install PECL pecl_http’;
}
if($ok) break;
if(function_exists(‘curl_init’)) {
$ch = curl_init($api_url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
$ok = true;
} else {
$result = ‘ERROR: PHP function curl_init not found. Install curl’;
}
break;
default :
$result = ‘ERROR: unknown command “‘ . $_REQUEST[‘command’] . ‘”‘;
}
echo $result;
}
?>