format(string, sizeof(string), "mydomain.ro/sendemail.php?code=44514&EmailTo=myemail@yahoo.com&Message=Salutare DiBlaine, acesta este un test!"); for(new c; c < strlen(string)+1; c++) if(string[c] == ' ') string[c] = '+'; HTTP(playerid, HTTP_POST, string, " ", "EmailDelivered");
Might be something wrong within the code though...
Show us the php file where you handle this request. |
<?php
if(isset($_GET['code'])) { //checks if request from SA:MP server contains code
$code = $_GET['code'];//Redefine just to look better :)
if($code == 44514) { // Compare code from SA:MP request, a.k.a password to avoid spam or unauthorized requests
if(isset($_GET['Message']) && !empty($_GET['Message'])) { //Checks if request from SA:MP server contains messag you want to send
//EmailTo[],Message[]
$emailto = $_GET['EmailTo'];
$message = $_GET['Message']; //Redefine just to look better :)
$message = str_replace("-"," ",$message); //Replace all - back to blank space as url cant contains blank spaces
mail($emailto, "Securitate cont / Account security", $message, "From: \"saveG.ro - Securitate cont / Account security\" <support@saveg.ro>\r\n" ."X-Mailer: PHP/" . phpversion());//Send an email, format: To,Subject,Message,From
echo "Email delivered"; //Response message to SA:MP server, so server knows request was valid
}
}
}
?>
Originally Posted by Eddy Freddy @ StackOverflow
RewriteEngine On
RewriteCond %{SERVER_PORT} 80 RewriteCond %{REQUEST_URI} !^/yournonhttpsdirectory/ RewriteRule ^(.*)$ https://www.domain.xyz/$1 [R,L] |
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>302 Found</title> </head><body> <h1>Found</h1> <p>The document has moved <a href="http://www.vodafone.ro/mydomain/?code=44514&EmailTo=myemail@yahoo.com&Mess age=test">here</a>.</p> </body></html> |
Did a test, this is what comes out of it. It's what Y_Less said, follow the redirect.
|
If they include a body, that's up to them, but it isn't required and will be in the headers. The headers are the standardised method that computers use, the HTML is just a fallback to show the user. What you showed above is just the body.
|
I think this is your problem. Because the HTTP function in samp doesn't follow redirects and you probably redirect all http requests over https with some file like .htaccess(if you use apache). Try to stop the redirect only for this url.
StackOverflow: https://stackoverflow.com/a/7073258 |
mydomain.ro/sendemail.php?
RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteCond %{REQUEST_URI} !^/sendemail.php RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R,L]
1. MAKE BACKUP of your current .htaccess file
2. find where the request is redirected to https 3. replace that part with the code bellow. 4. save and test Code:
RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteCond %{REQUEST_URI} !^/sendemail.php RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R,L] |
It should not be doing that. I tested and confirmed it worked.
Can you please show the contents of the .htaccess. may be the snippet isn't even executed because its redirected before. In .htaccess the order matters! |
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} !^/sendemail.php
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R,L]
RewriteEngine On
RewriteCond %{HTTP_HOST} ^mydomain\.ro [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://mydomain.ro/$1 [R,L]
RewriteRule ^whatsapp$ "https\:\/\/chat\.whatsapp\.com\/Jsb7br8C8Cw7995AWb5h4z" [R=301,L]
RewriteCond %{HTTP_HOST} ^mydomain\.ro$ [OR]
RewriteCond %{HTTP_HOST} ^www\.mydomain\.ro$
RewriteRule ^sugestii$ "https\:\/\/www\.forum\.mydomain\.ro\/index\.php\?\/forum\/82\-sugestii\/" [R=301,L]
RewriteCond %{HTTP_HOST} ^mydomain\.ro$ [OR]
RewriteCond %{HTTP_HOST} ^www\.mydomain\.ro$
RewriteRule ^discord$ "https\:\/\/discord\.gg\/KWWRDZj" [R=301,L]
RewriteCond %{HTTP_HOST} ^mydomain\.ro [NC] RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://mydomain.ro/$1 [R,L]
I presume your web server is hosted. You could ask the support team of the host company. Or may be the .htaccess, that redirects, is located in the directory where public_html is or may be your web server is not Apache but Nginx in which case .htaccess will not work.
Edit: I saw your edit Change these three lines with the snippet I gave you earlier: (These are the lines that redirect the whole traffic to https) Code:
RewriteCond %{HTTP_HOST} ^mydomain\.ro [NC] RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://mydomain.ro/$1 [R,L] |
RewriteEngine On
RewriteCond %{HTTP_HOST} ^mydomain\.ro [NC]
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} !^/sendemail.php
RewriteRule ^(.*)$ https://mydomain.ro/$1 [R,L]
RewriteRule ^whatsapp$ "https\:\/\/chat\.whatsapp\.com\/Jsb7br8C8Cw7995AWb5h4z" [R=301,L]
RewriteCond %{HTTP_HOST} ^mydomain\.ro$ [OR]
RewriteCond %{HTTP_HOST} ^www\.mydomain\.ro$
RewriteRule ^sugestii$ "https\:\/\/www\.forum\.mydomain\.ro\/index\.php\?\/forum\/82\-sugestii\/" [R=301,L]
RewriteCond %{HTTP_HOST} ^mydomain\.ro$ [OR]
RewriteCond %{HTTP_HOST} ^www\.mydomain\.ro$
RewriteRule ^discord$ "https\:\/\/discord\.gg\/KWWRDZj" [R=301,L]