Skip to content

Instantly share code, notes, and snippets.

@prensmiskin
Created July 15, 2021 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prensmiskin/ae7cccd40f4ce4b2ec3c7c7f4a38a77b to your computer and use it in GitHub Desktop.
Save prensmiskin/ae7cccd40f4ce4b2ec3c7c7f4a38a77b to your computer and use it in GitHub Desktop.
smsapi
<?php
function XMLPOST($PostAddress,$xmlData)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$PostAddress);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,2);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: text/xml"));
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlData);
$result = curl_exec($ch);
return $result;
}
$xml='<?xml version="1.0" encoding="UTF-8"?>
<mainbody>
<header>
<company dil="TR">Netgsm</company>
<usercode>delete</usercode>
<password>delete</password>
<type>1:n</type>
<msgheader>delete</msgheader>
</header>
<body>
<msg>
<![CDATA[Mesarrrj Metnim]]>
</msg>
<no>delete</no>
<no></no>
</body>
</mainbody>';
$gelen=XMLPOST('https://api.netgsm.com.tr/sms/send/xml',$xml);
echo $gelen;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment