Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function sendSMS($message)
- {
- $post = "Message de:";
- $post .= $_GET["nom"];
- $post .= ' - Msg:';
- $post .= $_GET["message"];
- //config
- $username = '****';
- $password = '**********';
- //config
- $url = 'https://smsapi.free-mobile.fr/sendmsg?user='.$username.'&pass='.$password.'&msg='.$post;
- $curl = curl_init();
- curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt_array($curl, array(
- CURLOPT_RETURNTRANSFER => 1,
- CURLOPT_URL => $url
- ));
- $httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
- if($httpCode == 404) {
- echo '404 serverside, check your username or password.';
- }
- elseif($httpCode == 200) {
- echo 'Message envoyé.';
- }
- elseif($httpCode == 400) {
- echo 'Missing parameter.';
- }
- elseif($httpCode == 402) {
- echo 'Too many SMS sent, please wait.';
- }
- elseif($httpCode == 403) {
- echo 'Service not enabled on your account.';
- }
- elseif($httpCode == 500) {
- echo 'Freemobile server error, please try again later.';
- }
- else
- {
- if(curl_exec($curl) === false)
- {
- echo 'Curl error: ' . curl_error($curl);
- }
- else
- {
- //echo 'ok!';
- }
- }
- curl_close($curl);
- }
- sendSMS('Yay, working !');
- header("Location: /index.php?code='. curl_error($curl) .'");
- die();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement