Call +91-40-30133133 for Indian queries, 971-501561627 (UAE) for Middle East, 852-60262470 for Hong kong (or)
Email to:contactus@smscountry.com
using Microsoft.VisualBasic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Text;
using System.Configuration;
using System.Web;
partial class Default3 : System.Web.UI.Page
{
private WebProxy objProxy1 = null;
protected void Page_Load(object sender, EventArgs e)
{
string api_key = "XxxXXXxxXXXXXXxXXXx";
string access_key = "XxxXXXxxXXXXXXxXXXxXxxXXXxxXXXXXXxXXXx";
string Mobile_Number = "9189xxxxxxxx";
string request = "";
string stringpost = null;
request = "<request action="http://smscountry.com/testdr.aspx"method="GET"><to>" + Mobile_Number + "</to><play>http://smscountry.com/voice_clips/4031001209_130806161411.wav</play></request>";
stringpost = "api_key=" + api_key + "&access_key=" + access_key + "&xml=" + request;
HttpWebRequest objWebRequest = null;
HttpWebResponse objWebResponse = null;
StreamWriter objStreamWriter = null;
StreamReader objStreamReader = null;
try
{
string stringResult = null;
objWebRequest = (HttpWebRequest)WebRequest.Create("http://voiceapi.smscountry.com/api ");
objWebRequest.Method = "POST";
objWebRequest.ContentType = "application/x-www-form-urlencoded";
objStreamWriter = new StreamWriter(objWebRequest.GetRequestStream());
objStreamWriter.Write(stringpost);
objStreamWriter.Flush();
objStreamWriter.Close();
objWebResponse = (HttpWebResponse)objWebRequest.GetResponse();
objStreamReader = new StreamReader(objWebResponse.GetResponseStream());
stringResult = objStreamReader.ReadToEnd();
objStreamReader.Close();
Response.Write(stringResult);
}
catch (Exception ex)
{
Response.Write("Something went wrong");
}
finally
{
if ((objStreamWriter != null))
{
objStreamWriter.Close();
}
if ((objStreamReader != null))
{
objStreamReader.Close();
}
objWebRequest = null;
objWebResponse = null;
objProxy1 = null;
}
}
public Default3()
{
Load += Page_Load;
}
}
Imports System.IO
Imports System.Net
Imports System.Text
Imports System.Configuration
Imports System.Data
Imports System.Web
Partial Class Default3
Inherits System.Web.UI.Page
Private objProxy1 As WebProxy = Nothing
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
Dim api_key As String = "XxxXXXxxXXXXXXxXXXx"
Dim access_key As String = "XxxXXXxxXXXXXXxXXXxXxxXXXxxXXXXXXxXXXx"
Dim Mobile_Number As String = "9189xxxxxxxx"
Dim request As String = ""
Dim stringpost As String = Nothing
request = "<request action=""http://smscountry.com/testdr.aspx"" method=""POST""><to>" & Mobile_Number & "</to><play>http://smscountry.com/voice_clips/4031001209_130806161411.wav</play></request>"
stringpost = "api_key=" & api_key & "&access_key=" & access_key & "&xml=" & request
Dim objWebRequest As HttpWebRequest = Nothing
Dim objWebResponse As HttpWebResponse = Nothing
Dim objStreamWriter As StreamWriter = Nothing
Dim objStreamReader As StreamReader = Nothing
Try
Dim stringResult As String = Nothing
objWebRequest = DirectCast(WebRequest.Create("http://voiceapi.smscountry.com/api "), HttpWebRequest)
objWebRequest.Method = "POST"
objWebRequest.ContentType = "application/x-www-form-urlencoded"
objStreamWriter = New StreamWriter(objWebRequest.GetRequestStream())
objStreamWriter.Write(stringpost)
objStreamWriter.Flush()
objStreamWriter.Close()
objWebResponse = DirectCast(objWebRequest.GetResponse(), HttpWebResponse)
objStreamReader = New StreamReader(objWebResponse.GetResponseStream())
stringResult = objStreamReader.ReadToEnd()
objStreamReader.Close()
Response.Write(stringResult)
Catch ex As Exception
Response.Write("Something went wrong")
Finally
If (objStreamWriter IsNot Nothing) Then
objStreamWriter.Close()
End If
If (objStreamReader IsNot Nothing) Then
objStreamReader.Close()
End If
objWebRequest = Nothing
objWebResponse = Nothing
objProxy1 = Nothing
End Try
End Sub
End Class
<?php
//Please Enter Your Details
$postData="";
$retval = "";
$CallBackURL="http://smscountry.com/testdr.aspx";
$FromMobile="91xxxxxxxxxx";
$ToMobile="91xxxxxxxxxx";
$Voice_Clip="http://smscountry.com/voice_clips/Soundclip146_13091128.wav";
$postData .= "api_key=XxxXXXxxXXXXXXxXXXx&access_key=XxxXXXxxXXXXXXxXXXxXxxXXXxxXXXXXXxXXXx";
$postData .= "&xml=<request action='". $CallBackURL . "' method='POST'><from>" . $FromMobile ."</from><to>". $ToMobile . "</to><play>" . $Voice_Clip ."</play></request>";
$url = "http://voiceapi.smscountry.com/api";
$ch = curl_init();
if (!$ch){die("Couldn't initialize a cURL handle");
}
$ret = curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt ($ch, CURLOPT_POSTFIELDS,$postData);
$ret = curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//If you are behind proxy then please uncomment below line and provide your proxy ip with port.
// $ret = curl_setopt($ch, CURLOPT_PROXY, "PROXY IP ADDRESS:PORT");
$curlresponse = curl_exec($ch);
// execute
if(curl_errno($ch))
echo 'curl error : '. curl_error($ch);
if (empty($ret))
{
// some kind of an error happened
die(curl_error($ch));
curl_close($ch);
// close cURL handler
}
else {
$info = curl_getinfo($ch);
curl_close($ch); // close cURL handler
echo $curlresponse; //echo "Message Sent Succesfully" ;
}
?>
Facebook Twitter LinkedIn Google Plus