调用PHP和ASP.NET之间/答案 [英] call/answer between PHP and ASP.NET

查看:214
本文介绍了调用PHP和ASP.NET之间/答案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能通过集成在ASP.net页的HTMLpage的文本区域提交电子邮件地址,并发送给PHP脚本,如果控制实际上是一个有效的电子邮件地址,并发送回给ASP页面,所以我可以得到一个警示:有效或无效。
我有2 webspeace有两个不同的网站:ASP.net,一个在PHP结果
该ASP.net页面在HTML一个WebForm。我想用这个来的电子邮件发送到PHP脚本。这符文验证,并发送回状态的ASP页面,将通过警报,邮件有效或无效。

Is it possible to submit an email address through a text area of an HTMLpage integrated in ASP.net page and send this to a PHP script that control if is actually a valid email address and send answer back to the ASP page so I can get an alert: VALID or NOT VALID. I have 2 webspeace with two different websites: ASP.net and one in PHP.
The ASP.net page has a Webform in HTML. I would like to use this to send the email to the PHP script. which rune the validation and send back the status to the ASP page that would answer through an alert, "mail valid" or "not valid."

这个想法我是脚本(验证控件后)具有传送一个答案抛出一个URL到ASP页和ASP页将听/搞定这个URL作为一个变量,以diplay与警报P​​HP脚本的结果。

The idea I have is that the script (after the validation control) has to send back an answer throw an URL to the ASP page and the ASP page would "listen"/ "get" this URL as a variable in order to diplay with an alert the result of the PHP SCRIPT

PHP端:

    <form action="http://www.exemple.com/scripts/mailvalidation.php" method="post"        id="webform">

SCRIPT PHP? (也许使用PHP FILTER_VALIDATE_EMAIL)?

SCRIPT PHP ? (maybe using the PHP FILTER_VALIDATE_EMAIL) ?

ASP.NET?

任何建议=?

推荐答案

听起来就像使用AJAX的理想场所。它是独立使用的语言。 PHP,ASP.NET,JSP是完全一样的。所有这一切需要的是简单的JavaScript或Jquery的。

Sounds like a perfect place to use AJAX. It is independent of the language you use. PHP, ASP.NET, JSP it is all the same. All that is needed is simple JavaScript or Jquery.

在你的ASP页面,

<form id="myform">
<input type="email" id="email" name="email" />
<button>Submit</button>
</form>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

<script type="application/javascript">
$(document).ready(function(){

var formvars = $("#myform").serialize();

var url = "http://www.example.com/your_page.php?" + formvars;


    $.ajax({
        url: url,
        cache:'false',
        dataType: 'text',
        type:"GET",
        success: function(data){
          //alert( data );
           alert( data );
           if(data =="1")
               alert("VALID");
           else
               alert("IN VALID");

        },
        error: function(data){
          alert('error; '+ eval(error));
        }
       });


 });
</script>

在你的PHP脚本,

<?php

$email = $_REQUEST["email"]
if($email, FILTER_VALIDATE_EMAIL))
   echo "1";
else
   echo "0";
?>

祝你好运。

这篇关于调用PHP和ASP.NET之间/答案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆