2014-02-06 53 views
0

我有一个联系表,它应该发送一个电子邮件与用户正在观看的产品链接,问题是我需要使用iframe,因为服务器不接受PHP文件,所以我有这个:来自iframe的电子邮件URL

$name = clearValue($_POST["name"]); 
     $lastname = clearValue($_POST["lastname"]); 
     $company = clearValue($_POST["company"]); 
     $phone = clearValue($_POST["phone"]); 
     $country = clearValue($_POST["country"]); 
     $quantity = clearValue($_POST["quantity"]); 
     $mail = ($_POST["mail"]); 
     $message = clearValue(nl2br($_POST["message"])); 
     $type_quote = clearValue($_POST["type"]); 
     $page = currentPageURL(); 

$headers = "Content-type: text/html\r\nFrom: $fromMailStatus \r\nReply-To: $fromMailStatus"; 
    $body = file_get_contents("resources/mails/mail_newWebLead.htm"); 
    $body = str_replace("{name}",$name,$body); 
    $body = str_replace("{lastname}",$lastname,$body); 
    $body = str_replace("{company}",$company,$body); 
    $body = str_replace("{phone}",$phone,$body); 
    $body = str_replace("{country}",$iPais["nombre"],$body); 
    $body = str_replace("{language}",$iLang["nombre"],$body); 
    $body = str_replace("{quantity}",$quantity,$body); 
    $body = str_replace("{email}",$mail,$body); 
    $body = str_replace("{message}",$message,$body); 
    $body = str_replace("{link}",$page,$body); 
    $body = str_replace("{ip}",$ip_source,$body); 

    mail($para,"New Web Lead",$body,$headers); 

function currentPageURL() { 
    $pageURL = 'http'; 
    if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";} 
    $pageURL .= "://"; 
    if ($_SERVER["SERVER_PORT"] != "80") { 
     $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; 
     } else { 
     $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; 
    } 
    return $pageURL; 
} 

这个工程,但它返回的页面,iFrame被调用,我需要原始URL,我怎么能这样做?

+0

我不太明白,究竟什么是 “原始URL”?您拥有包含您获取的iframe的网页的网址。你也知道iframe内容的URL,因为那是你的PHP脚本...所以...你在找什么? – Tularis

+0

我不能得到生成iframe的URL。 –

+0

你可以试试$ _SERVER ['HTTP_REFERER'],但我不确定这是否会起作用 – Pierre

回答

相关问题