表单在 1 台和 1 台主机上运行,但在正确的主机上运行不正常
我有一个在 asp 页面中创建的表单,并将其提交到 php 页面。当我在主机中测试它时,这是有效的,但主机不是我想要文件的地方。我将其添加到 1and1 主机,因为这是我更频繁使用的主机,只是为了测试它。
我需要它用于托管在 fasthost 上的叔叔网站,问题是当我按发送时收到此错误:
405 - HTTP verb used to access this page is not allowed.
The page you are looking for cannot be displayed because an invalid method (HTTP verb) was used to attempt access.
我不明白这在 1and1 上有效,为什么当我上传文件时这在 fasthost 上不起作用?
我将非常感谢任何答案。
谢谢
编辑: 我搜索了又搜索,找到了帮助文件。 这个问题似乎与实际主机和在 php 文件中添加 -f 有关。我仍然没有得到这个工作,但希望得到任何帮助。我看到的页面是 http://www.fasthosts.co.uk /knowledge-base/?article_id=70
我已经编辑了 php 文件,但这不起作用,php 代码是:
<?php
$name= $_POST['frmName'];
$email_from = $_POST['frmEmail'];
$field_phone = $_POST['frmPhone'];
$field_address = $_POST['frmAddress'];
$field_referral = $_POST['frmReferral'];
$field_frmCallback = $_POST['frmCallback'];
$field_frmEnquiry = $_POST['frmEnquiry'];
$email_to = '[email protected]';
$body_message = 'From: '.$name."\n";
$body_message .= 'E-mail: '.$email_from."\n";
$body_message .= 'Phone: '.$field_phone."\n";
$body_message .= 'Address: '.$field_address."\n";
$body_message .= 'Referral: '.$field_referral."\n";
$body_message .= 'Callback: '.$field_frmCallback."\n";
$body_message .= 'Enquiry: '.$field_frmEnquiry;
$headers = "MIME-Version: 1.0\r\n";
$headers = 'From: '.$frmEmail."\r\n";
$subject = "Moroccan Properties Customer";
$headers .= "Content-Type: multipart/alternative;boundary=" . $boundary . "\r\n";
$message = "This is a MIME encoded message.";
$message .= "\r\n\r\n--" . $boundary . "\r\n";
$message .= "Content-type: text/plain;charset=utf-8\r\n\r\n";
$message .= "This is the text/plain version.";
$message .= "\r\n\r\n--" . $boundary . "\r\n";
$message .= "Content-type: text/html;charset=utf-8\r\n\r\n";
$message .= "This is the <b>text/html</b> version.";
$message .= "\r\n\r\n--" . $boundary . "--";
ini_set("sendmail_from", "[email protected]");
$mail_status = mail($email_to, $subject, $body_message, $headers, "[email protected]");
if ($mail_status) { ?>
<script language="javascript" type="text/javascript">
alert('Thank you for the message. We will contact you shortly.');
window.location = 'http://www.moroccanpropertiesltd.com/contact.asp';
</script>
<?php
}
else { ?>
<script language="javascript" type="text/javascript">
alert('Message failed. Please, send an email to [email protected]');
window.location = 'url';
</script>
<?php
}
?>
如果有人能指出我做错了什么,我将不胜感激。
谢谢
I have a form which I created in an asp page and this submits to a php page. This was working when I tested it in my host which is not where I want the files. I added it to the 1and1 host as this is what I use more frequently just to test it.
I needed it for my uncles site that is hosted on fasthost and the problem is I receive this error when I press send:
405 - HTTP verb used to access this page is not allowed.
The page you are looking for cannot be displayed because an invalid method (HTTP verb) was used to attempt access.
I don't understand this worked on 1and1 why would this not work on fasthost when I upload the files there?
I would highly appreciate any answers.
Thanks
Edit:
I have searched and searched and come across help files.
This problem seems to be something to do with the actual host and adding -f into the php file. I have still not got this working but would appreciate any help on this. The page I saw this on is http://www.fasthosts.co.uk/knowledge-base/?article_id=70
I have edited the php file and this is not working the php code is:
<?php
$name= $_POST['frmName'];
$email_from = $_POST['frmEmail'];
$field_phone = $_POST['frmPhone'];
$field_address = $_POST['frmAddress'];
$field_referral = $_POST['frmReferral'];
$field_frmCallback = $_POST['frmCallback'];
$field_frmEnquiry = $_POST['frmEnquiry'];
$email_to = '[email protected]';
$body_message = 'From: '.$name."\n";
$body_message .= 'E-mail: '.$email_from."\n";
$body_message .= 'Phone: '.$field_phone."\n";
$body_message .= 'Address: '.$field_address."\n";
$body_message .= 'Referral: '.$field_referral."\n";
$body_message .= 'Callback: '.$field_frmCallback."\n";
$body_message .= 'Enquiry: '.$field_frmEnquiry;
$headers = "MIME-Version: 1.0\r\n";
$headers = 'From: '.$frmEmail."\r\n";
$subject = "Moroccan Properties Customer";
$headers .= "Content-Type: multipart/alternative;boundary=" . $boundary . "\r\n";
$message = "This is a MIME encoded message.";
$message .= "\r\n\r\n--" . $boundary . "\r\n";
$message .= "Content-type: text/plain;charset=utf-8\r\n\r\n";
$message .= "This is the text/plain version.";
$message .= "\r\n\r\n--" . $boundary . "\r\n";
$message .= "Content-type: text/html;charset=utf-8\r\n\r\n";
$message .= "This is the <b>text/html</b> version.";
$message .= "\r\n\r\n--" . $boundary . "--";
ini_set("sendmail_from", "[email protected]");
$mail_status = mail($email_to, $subject, $body_message, $headers, "[email protected]");
if ($mail_status) { ?>
<script language="javascript" type="text/javascript">
alert('Thank you for the message. We will contact you shortly.');
window.location = 'http://www.moroccanpropertiesltd.com/contact.asp';
</script>
<?php
}
else { ?>
<script language="javascript" type="text/javascript">
alert('Message failed. Please, send an email to [email protected]');
window.location = 'url';
</script>
<?php
}
?>
I would be highly grateful if someone could point out what I have done wrong.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
听起来您的主机未设置为托管 .php 页面?您是否尝试过使用 .asp 版本?通常您不会混合使用两种脚本语言。
Sounds like your hosting isn't setup to host .php pages? Have you tried using the .asp version? Usually you don't mix the two scripting languages.
您必须使用 Fasthosts 启用脚本,它位于网站下的控制面板中,可以选择不同版本的 PHP,还有 ASP 等。
You have to enable scripting with Fasthosts, its in the control panel under website, there is the ability to select different versions of PHP, and also ASP etc etc.