Kwesi Chambas

Kwesi Chambas

  • NA
  • 1
  • 853

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

Aug 2 2016 1:26 PM
<?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)