Jump to content

SMS order notification


Recommended Posts

Hi all, having great results with WHMcs.

 

I've devised a way of sending an order notification via TXT to your mobile. It uses an API at txtlocal.com

 

I have put this in the checkoutscript.php in hope to get a text notification when an order is made.

 

However at the moment when the checkout script runs it executes some output of your remaining txt credits and then does not pass the order to the invoice and you chosen payment processor. :(

 

Can anyone help me out with this? I need it to execute the code but not pop up any output in the browser and send them through to the payment processor to actually PAY! :-)

 

 

Here it is

 

checkoutscript.php

 

<?php
/*
**************************************************
************** WHMCS CheckOut Script *************
**************************************************
You may enter code here which will be run when
a user checks out if you have enabled it in
Configuration > General Configuration > Other
of your WHMCS Admin Area.  The following
variables are available to you:
**************************************************
Order ID: $orderid
Order Number: $ordernumber
Invoice ID: $invoiceid
Product ID: $productid
Domain ID: $domainid
Addons Array: $addons
**************************************************
*/

//set up variables
$info = "1"; 
$address = "txtlocal.com/sendsmspost.php";
$message = "Host Yorkshire Web Site Order Pending. Visit WHCMS to activate?";
$message = urlencode($message); //encode special characters (e.g. £,& etc)
$from = "Host Yorkshire";
$uname = "myemail@hostyorkshire.dotcom"; 
$pword = "#######";
$selectednums = "44787####"; 

//build url
$data = "uname=" . $uname . "&pword=" . $pword . "&message=" . $message . "&from=" . $from . "&selectednums=" . $selectednums . "&info=" . $info;

//send messages
$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL,"https://$address");
curl_setopt($ch, CURLOPT_POST, 1); 
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_exec ($ch); 
curl_close ($ch); 
?>

 

 

It part works....errrmmm....??

 

Your thoughts?

Link to comment
Share on other sites

Now I stubmbled across this mod. It would be good to pull the details from the database and include some of them in the SMS.

 

Is anyone cleaver enough on here to do this and help me?

I'm certainly not good enough with PHP to hack about...

 

// SolidNetwork, Inc - EastSolid.com

// CheckOutScript.php - v 1.0
//
//  This file will be ran once an order has been place
// and is in the system. You are free to edit this script
// to your liking. 

 

It would certainly be a very good way to view your pending orders via SMS if I could combine the two.

Link to comment
Share on other sites

I'm not much with php but could you not put your sms code as the last thing to execute in the checkout.php file? Even place it in a separate file and do an:

 

include("your_sms_file");

 

at the end of the checkout.php file. That way nothing is interfered with. Or maybe I didn't understand the question.

Link to comment
Share on other sites

Hey,

 

I don't even understand your question. You post part of my code randomly and go on with a SMS gateway. Could you explain a little more? Like you want an SMS message to be sent to your phone on all orders, etc...

 

Thanks,

Adam

Link to comment
Share on other sites

Adam, what I was trying to do was see if both the contributions could be merged so that it could pull certain bits of info from the mySQL database like your script does and then post the data to me in an SMS instead of an email, that's all.

 

At the moment I have got it sending me just a standard SMS message with no specific data about the support ticket or new order.

Link to comment
Share on other sites

Adam, what I was trying to do was see if both the contributions could be merged so that it could pull certain bits of info from the mySQL database like your script does and then post the data to me in an SMS instead of an email, that's all.

 

 

Ah, thats easy. Just add your code to the bottom part my script and your good to go :)

 

From,

Adam

Link to comment
Share on other sites

Easier said than done, I'm no php expert! :?

 

Hey,

 

Replace code from LINES 214 - 260 with the below.

 


$messageCHKOUT = " 
---------------------------------------------------------
                   Order Information
---------------------------------------------------------
Order ID: $orderid
Order Number: $ordernumber
Timestamp: $datetimefull

---------------------------------------------------------
                  Order has been placed
---------------------------------------------------------
Customer ID: $userid
Name: $firstname $lastname
Email: $email
Company: $companyname
Address 1: $address1
Address 2: $address2
City: $city 
State: $state
Postcode: $postcode 
Country: $country 
Phone Number: $phonenumber 

---------------------------------------------------------
                    Order Information
---------------------------------------------------------
Product: $type $productidName 
Description: $description 
Domain: $domain
Invoice ID: $invoiceid 
First Payment: $firstpaymentamount 
After First Payment: $amount
Billing Cycle: $billingcycle 
Next Due Date: $nextduedate of $amount

---------------------------------------------------------
                     ISP Information
---------------------------------------------------------
IP: $ip 
Host: $host 
Timestamp: $datetimefull 

";


// You got mail!
mail($emailto,	$subject, $messageCHKOUT , $headers);


//set up variables
$info = "1";
$address = "txtlocal.com/sendsmspost.php";
$message = "Host Yorkshire Web Site Order Pending. Visit WHCMS to activate?";
$message = urlencode($messageCHKOUT ); //encode special characters (e.g. £,& etc)
$from = "Host Yorkshire";
$uname = "myemail@hostyorkshire.dotcom";
$pword = "#######";
$selectednums = "44787####";


//build url
$data = "uname=" . $uname . "&pword=" . $pword . "&message=" . $message . "&from=" . $from . "&selectednums=" . $selectednums . "&info=" . $info; 

//send messages
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://$address");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_exec ($ch);
curl_close ($ch); 

 

 

That should work guessing that all your PHP SMS code is correct...

 

 

From,

Adam

Link to comment
Share on other sites

I like thanks for this txtlocal.com would give whmcs promo codes im sure to help everyone else along a little also :) all i need now is to integrate my onebip.com merchant account so people can buy hosting from there mobiles :)

 

So whats your question? You are jumping around from txtlocal to promo codes to ordering hosting on your phone (not sure how many people will actually do that, or if thats even a good idea), but can you explain a little more.

 

Thanks,

Adam

Link to comment
Share on other sites

No one bip allows people to buy anything hosting products etc buy biling customers mobile phones say a 16 yr old who wants his own web site but doesnt have a credit card could use his pay as you go credit (this thought poped into mind when i was adding your script was all.but basically i was saying TY for the addon. it was 2:17 am so a little blurry im afraid.

Link to comment
Share on other sites

No one bip allows people to buy anything hosting products etc buy biling customers mobile phones say a 16 yr old who wants his own web site but doesnt have a credit card could use his pay as you go credit (this thought poped into mind when i was adding your script was all.but basically i was saying TY for the addon. it was 2:17 am so a little blurry im afraid.

 

That is a bloody good idea !!

Link to comment
Share on other sites

  • 1 year later...

Actually, i've got to say its a bad idea, for a couple of reasons.

hoever, these comments are based on my own values and morals (and yes these do have a place in business) as well as some basic business law. If these principle don't exist or apply in your country, then say so.

 

Firstly, in AU, to have a website (and therefore first a domain name) you must have some sort of incorporation. Sole trader, partnership, Pty Ltd etc, or community group registration. No-one under 18 is allowed by law to have these, as some-one under 18 cannot sign an ENFORCEABLE contract. There are good reasons for this, not the least of which is protection of the minor themselves.

 

Second, what possible business model could anyone come up with that relies on doing business with minor, save those disreputable ring-tone companies?

 

Third, given that kids are often not repsonsible for their actions responsible kids = oxymoron), if they create a spam/hack/kiddie script site, you have no one to sue, and only yourself to blame. And likely you'll be the one bearing the consequences.

 

And Finally, the great majority of minor's mobile phone bills are paid for by their parents. Is a business so really interested in profits that they would seek to suck the funds out of gullible children's mobile phone accounts (again with the exception of the previous example), just for the sake of a couple of extra bucks?

 

Come on guys, kids are protected for a reason. Don't sacrifice you business standards just for a couple of bucks.

 

Here endeth the lesson.

Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated