var request:URLRequest = new URLRequest( "http://www.freeapi.tw/submit.php" );
var variables:URLVariables = new URLVariables();
variables.email = emailSubmitText;
request.data = variables;
request.method = URLRequestMethod.POST;
sendToURL(request);
PHP部分
<?php
$emailAddress = $_POST['email'];
$to = "AA@BB.CC";
$subject = "You have a new subscriber";
$body = $emailAddress;
if (mail($to, $subject, $body)) {
echo("Your message was sent");
} else {
echo("There was a problem.");
}
?>
本站使用http://tohtml.com/高亮度語法
參考來源:
http://eddieoleary.com/2008/01/08/sending-form-data-with-actionscript-3/
http://tush.wordpress.com/2007/07/20/actionscript-3-using-urlloader-to-send-and-load-server-variables/