Hi Everyone,
I'm not sure if I may be in the wrong venue to post as this would have to do with PHP, CURL and SSL, so I've decided to place the question here. Please feel free to let me know if the question should be dropped in some other location…
My company has been using a ticketing system that is hosted on another server being cloud based which uses a RESTful style API over HTTP using XML. They also use HTTP Basic Authentication over SSL to secure data.
For any options worth knowing, the cloud based ticketing system cannot host any of the custom forms that we've designed. They will not allow any custom additions to their tables either. So, utilizing the API is out of the question because of the custom form data requirements which demand more columns than that are currently provided by the ticketing systems API.
Logically, the solution is now deduced to one alternative; to submit and email data from a custom form from another server - securely if possible.
The server hosting the custom forms would have no issue of SSL being implemented – which would at least to provide security for the front end, however, it is the backend in were my question is; how is it that this data can be secured and/or is there a secure way of providing a secure tunnel through PHP and/or CURL by the ticketing systems server authentication?
The information too that is being submitted is not a high security risk such as HIPPA, Social Security Cards, Credit cards or even purchase related. Basically, the submitted information would only contain names, phone numbers and messages regarding product information.
Is it possible that one could use a client URL (CURL) with PHP to authenticate then email the data to the ticketing system and view this as secure way of submitting the data? Should specific headers be used to indicate authentication, etc.? How would IT regard this as being secure? What would be the best way to write this code? What could be regarded as the best way to secure data when emailing?
Basically, the cloud hosted ticketing system provides a unique email address in which the data will be submitted to. My assumption is that one could utilize the cloud hosted HTTP Basic Authentication over SSL in which they would provide a unique username and an authentication token as a password. Would this be regarded as securing submitted data? The only thing I really see is that this would simply verify that the ticketing system server to be true before the data has been submitted. If not, no data is therefore submitted which can provide some measure of security.
I’ve used curl plenty of times in the past to update, delete, put, post and get, but never emailed, so I’m not sure if this would really be a secure way to go? Documentation is a bit fragmented as I’ve pulled fruitless searches on this subject, but I’ve provided a theoretical and very simple script below (which I have not tested) in order to invite any feedback. If any of you have had more experience in this area, please feel free to expand.
Thank you and keep up the great coding that all of you do!
<?php ob_start();
$Name = $_POST['name'];
$from_email = $_POST['email'];
$phone = $_POST['phone'];
$message = $_POST['message'];
if( !empty($Name)) {
$sender = $from_email;
$receiver = '129zop78as7q0c7b28f3728soq1b45m31@somedomain.com'; //
$email_body = "Name: $Name \nEmail: $from_email \nPhone No: $phone \nMessage: $message \n";
$extra = "Reply-To: $sender \r\n" . "X-Mailer: PHP/" . phpversion();
// URL FOR AUTHENTICATION =============
$url = 'https://ticketingsystem.com/';
// INITIALIZE CURL ====================
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// USERNAME AND TOKEN ID ===============
curl_setopt($ch, CURLOPT_USERPWD, sprintf('%s:%s', '123456', '3ecb5f17-e219-6801-64d8-cb3027def0e8'));
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC | CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
curl_close($ch);
// SEND MAIL ==========================
if( mail( $receiver, $email_body, $extra ) ) {
// IF SUCCESSFUL, REDIRECT ============
header("Location: https://ticketingsystem.com/thankyou.php");
}
else
{
header("Location: https://ticketingsystem.com/nogo.php");
}
}
ob_flush();