50% OFF ANY SOFTWARE WITH PROMO CODE 24spring50

Buy Now
menu

SMS gateway usage example for PHP


Send SMS:

<?php	
	$src = '<?xml version="1.0" encoding="UTF-8"?>	
	<SMS>	
	<operations>	
	<operation>SEND</operation>	
	</operations>	
	<authentification>	
	<username></username>	
	<password></password>	
	</authentification>	
	<message>	
	<sender>SMS</sender>	
	<text>Test message [UTF-8]</text>	
	</message>	
	<numbers>	
	<number messageID="msg11">380972920000</number>	
	</numbers>	
	</SMS>';	

	$Curl = curl_init();	
	$CurlOptions = array(	
	CURLOPT_URL=>'http://api.atompark.com/members/sms/xml.php',	
	CURLOPT_FOLLOWLOCATION=>false,	
	CURLOPT_POST=>true,	
	CURLOPT_HEADER=>false,	
	CURLOPT_RETURNTRANSFER=>true,	
	CURLOPT_CONNECTTIMEOUT=>15,	
	CURLOPT_TIMEOUT=>100,	
	CURLOPT_POSTFIELDS=>array('XML'=>$src),	
	);	
	curl_setopt_array($Curl, $CurlOptions);	
	if(false === ($Result = curl_exec($Curl))) {	
	throw new Exception('Http request failed');	
	}	

	curl_close($Curl);	

	echo $Result;	
	?>

Getting status of sent SMS*:


<?php	
	$src = '<?xml version="1.0" encoding="UTF-8"?>	
	<SMS>	
	<operations>	
	<operation>GETSTATUS</operation>	
	</operations>	
	<authentification>	
	<username></username>	
	<password></password>	
	</authentification>	
	<statistics>
        <messageid>msg11</messageid>	
	</statistics>	
	</SMS>';	

	$Curl = curl_init();	
	$CurlOptions = array(	
	CURLOPT_URL=>'http://api.atompark.com/members/sms/xml.php',	
	CURLOPT_FOLLOWLOCATION=>false,	
	CURLOPT_POST=>true,	
	CURLOPT_HEADER=>false,	
	CURLOPT_RETURNTRANSFER=>true,	
	CURLOPT_CONNECTTIMEOUT=>15,	
	CURLOPT_TIMEOUT=>100,	
	CURLOPT_POSTFIELDS=>array('XML'=>$src),	
	);	
	curl_setopt_array($Curl, $CurlOptions);	
	if(false === ($Result = curl_exec($Curl))) {	
	throw new Exception('Http request failed');	
	}	

	curl_close($Curl);	

	echo $Result;	
	?>

* The SMS status information will be available in a few minutes.


Getting a price of the SMS:

<?php	
	$src = '<?xml version="1.0" encoding="UTF-8"?>	
	<SMS>	
	<operations>	
	<operation>GETPRICE</operation>	
	</operations>	
	<authentification>	
	<username></username>	
	<password></password>	
	</authentification>	
	<message>	
	<sender>SMS</sender>	
	<text>Test message [UTF-8]</text>	
	</message>	
	<numbers>	
	<number messageID="msg11">380972920000</number>	
	</numbers>	
	</SMS>';	

	$Curl = curl_init();	
	$CurlOptions = array(	
	CURLOPT_URL=>'http://api.atompark.com/members/sms/xml.php',	
	CURLOPT_FOLLOWLOCATION=>false,	
	CURLOPT_POST=>true,	
	CURLOPT_HEADER=>false,	
	CURLOPT_RETURNTRANSFER=>true,	
	CURLOPT_CONNECTTIMEOUT=>15,	
	CURLOPT_TIMEOUT=>100,	
	CURLOPT_POSTFIELDS=>array('XML'=>$src),	
	);	
	curl_setopt_array($Curl, $CurlOptions);	
	if(false === ($Result = curl_exec($Curl))) {	
	throw new Exception('Http request failed');	
	}	

	curl_close($Curl);	

	echo $Result;	
	?>

Getting current balance

<?php	
	$src = '<?xml version="1.0" encoding="UTF-8"?>	
	<SMS>	
	<operations>	
	<operation>BALANCE</operation>	
	</operations>	
	<authentification>	
	<username></username>	
	<password></password>	
	</authentification>		
	</SMS>';	

	$Curl = curl_init();	
	$CurlOptions = array(	
	CURLOPT_URL=>'http://api.atompark.com/members/sms/xml.php',	
	CURLOPT_FOLLOWLOCATION=>false,	
	CURLOPT_POST=>true,	
	CURLOPT_HEADER=>false,	
	CURLOPT_RETURNTRANSFER=>true,	
	CURLOPT_CONNECTTIMEOUT=>15,	
	CURLOPT_TIMEOUT=>100,	
	CURLOPT_POSTFIELDS=>array('XML'=>$src),	
	);	
	curl_setopt_array($Curl, $CurlOptions);	
	if(false === ($Result = curl_exec($Curl))) {	
	throw new Exception('Http request failed');	
	}	

	curl_close($Curl);	

	echo $Result;	
	?>



Other examples:

SMS gateway usage example for Java


SMS gateway usage example for C#


SMS gateway usage example for Perl


SMS gateway usage example for Python