Created
October 22, 2016 14:42
-
-
Save quentin-aslan/fa1ef275d19ce30ee996f2235d5352d2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
$name = $_POST['nom']; | |
$subject = $_POST['sujet']; | |
$email = $_POST['email']; | |
$text = $_POST['text']; | |
$dest = "[email protected]"; | |
$data = array( | |
'dest' => $dest, | |
'sender' => $email, | |
'message' => $text, | |
'subject' => $subject, | |
'name' => $name | |
); | |
$json = json_encode($data); | |
$ch = curl_init("http://cobra.pata.ovh/sendmail"); | |
curl_setopt($ch, CURLOPT_URL, "https://cobra.pata.ovh/sendmail"); | |
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, $json); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json')); | |
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); | |
var_dump($json); | |
$res = curl_exec($ch); | |
if($res === FALSE) { | |
die(curl_error($ch)); | |
}else { | |
echo "success"; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment