I have a project that I am working on where I need to take a snap shot from a webcam and send it via sms.
I have code to take the pic and code to send a text and they both work, but I cannot seem to combine the two to get the pic to send.
I would think that adding $result here
$formatted_number = $to."@vzwpix.com";
mail("$formatted_number", "SMS", "$message", "$result");
would work, but it doesn't. (I am only concerned with verizon at the moment)
Here is entire php code:
<?php
/* JPEGCam Test Script */
/* Receives JPEG webcam submission and saves to local file. */
/* Make sure your directory has permission to write files as your web server user! */
$filename = date('YmdHis') . '.jpg';
$result = file_put_contents( $filename, file_get_contents('php://input') );
if (!$result) {
print "ERROR: Failed to write data to $filename, check permissions\n";
exit();
}
$url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['REQUEST_URI']) . '/' . $filename;
print "$url\n";
$from = $_POST['from'];
$to = $_POST['to'];
$carrier = $_POST['carrier'];
$message = stripslashes($_POST['message']);
if ((empty($from)) || (empty($to)) || (empty($message))) {
//header ("Location: sms_error.php");
}
else if ($carrier == "verizon") {
$formatted_number = $to."@vzwpix.com";
mail("$formatted_number", "SMS", "$message", "$result");
// Currently, the subject is set to "SMS". Feel free to change this.
//header ("Location: sms_success.php");
}
else if ($carrier == "tmobile") {
$formatted_number = $to."@tomomail.net";
mail("$formatted_number", "SMS", "$message");
// header ("Location: sms_success.php");
}
else if ($carrier == "sprint") {
$formatted_number = $to."@messaging.sprintpcs.com";
mail("$formatted_number", "SMS", "$message");
//header ("Location: sms_success.php");
}
else if ($carrier == "att") {
$formatted_number = $to."@txt.att.net";
mail("$formatted_number", "SMS", "$file_put_contents()");
//header ("Location: sms_success.php");
}
else if ($carrier == "virgin") {
$formatted_number = $to."@vmobl.com";
mail("$formatted_number", "SMS", "$message");
//header ("Location: sms_success.php");
}
?>
Thanks for any help.
-Sean