2
Answers

I want to Convert a PHP SMS API code to ASP.net C# code

Kwesi Chambas

Kwesi Chambas

8y
274
1
<?php    
$contacts = array(  "233XXXXXXXXX" => "John",  "233XXXXXXXXX" => "Baptist",   );
foreach($contacts as $number => $name){  
$url = "http://api.mytxtbox.com/v3/messages/send?".  
"From=Dawunis"  
."&To=$number"  
."&Content=".urlencode("Dear $name, enjoy a up to 50% discount on all Leather Bags. Use coupon code FIFTY-OFF to checkout. http://www.dawunisboutique.com.")  
."&ClientId=btgpchyh"  
."&ClientSecret=gafzdfso"  
."&RegisteredDelivery=true";   

$curl = curl_init();   
curl_setopt_array($curl, array(  CURLOPT_URL => $url,  CURLOPT_RETURNTRANSFER => true,  CURLOPT_CUSTOMREQUEST => "GET",  ));   
$response = curl_exec($curl);  $err = curl_error($curl);   curl_close($curl);   

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

?>
Answers (2)