Created
April 2, 2012 19:07
-
-
Save jaboutboul/2286400 to your computer and use it in GitHub Desktop.
Twilio SMS Distribution JS Modal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$ACCOUNT_SID = ''; | |
$AUTH_TOKEN = ''; | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Modal Form SMS</title> | |
<link href="style.css" rel="stylesheet"/> | |
<script type="text/javascript"> | |
function overlay() { | |
el = document.getElementById("overlay"); | |
el.style.visibility = (el.style.visibility == "visible") ? "hidden" : "visible"; | |
} | |
</Script> | |
</head> | |
<body> | |
<h3>Click the Twilio logo below to SMS a link to this page to someone!</h3> | |
<a href='#' onclick='overlay()'><img src="logo.png"/></a> | |
<div id="overlay"> | |
<div> | |
<h4>Enter a phone number below:</h4> | |
<form action="process.php" method="GET"> | |
<input type="text" name="number" placeholder="Phone Number"><br/> | |
<span>Example: +12125551212</span> | |
<br/> | |
<br/> | |
<button type="submit">Submit</button> | |
</form> | |
<h5>Click here to <a href='' onclick='overlay()'>close</a></h5> | |
</div> | |
</div> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//include the twilio-php library | |
include "twilio-php/Services/Twilio.php"; | |
//include out credentials file with our Account SID and Auth Token | |
include "twilio-php/credentials.php"; | |
//set our outgoing number | |
$outgoing_number = ""; | |
//set the number we are sending an sms to from POST requests | |
$number = $_REQUEST['number']; | |
//instantiate a new $client object | |
$client = new Services_Twilio($ACCOUNT_SID, $AUTH_TOKEN); | |
//send our message to the person | |
$message = $client->account->sms_messages->create($outgoing_number,$number,"Click to download our app on the Apple App Store: http://itunes.apple.com/us/app/angry-birds-space/id499511971"); | |
//print some output showing us the message SID and number it was sent to, just as a confirmation | |
echo "Message ID: " . $message->sid . " sent to: " . $number . "<br/>"; | |
//link to return to main page | |
echo "<a href=\"index.html\">Click here to return</a>"; | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#overlay { | |
visibility: hidden; | |
position: absolute; | |
left: 0px; | |
top: 0px; | |
width:100%; | |
height:100%; | |
text-align:center; | |
z-index: 1000; | |
} | |
#overlay div { | |
width:300px; | |
margin: 100px auto; | |
background-color: #fff; | |
border:1px solid #000; | |
padding:15px; | |
text-align:center; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment