enviando valores desde el cuadro de texto de la página php al cuadro de texto del sitio web asp.net

I am developing a website in PHP. I have a login form in my website. Students when enter their username and password, it shall redirect them to a ASP.NET website(not my website) which again have a login form, and the username and password entered by the students in my PHP website shall appear on that ASP.NET webpage textboxes of login form automatically.

I tried searching about it and come to know that using CURL it is possible, but it's something new to me and taking time. Kindly, help me if there is some solution to this problem of mine.

preguntado el 27 de noviembre de 13 a las 05:11

Your webform will undoubltly POST to a service once filled in, why not POST to the same endpoint from the PHP page? Or am I missing something? -

I would extremely encourage you to read about cURL, at the end you will use it in many other occasions -

ASP.NET website is under someone else's control. Do I need to do something to my PHP login page? -

@Karishma - Change your PHP form's target URL and make sure you're request looks a lot like the one submitted by the ASP page itself. You can use Fiddler, Wireshark, etc to help you identify things that must be done. -

1 Respuestas

The only way you can auto-fill forms in a web page that you don't have control over is by creating a browser plugin. Major web browsers provide the capability of altering the HTML on loaded pages using custom plug-ins. You would watch each page load for the URL on your site to read the values entered for the username and password, storing this data in your plugin. You would also watch for the URL you are targeting and auto-fill the form fields when the URL is the target web site. If the target web site is looking at the HTTP Referrer header, and/or using a nonce, to verify that the request came from their site than having your users install a custom browser plugin is the only way it can be done.

If the target web site doesn't look at the HTTP referrer and/or isn't using a nonce and you are only trying to create an auto-login than you can simply post to their form by returning a web page such as the following...

<?php

// Modify these to match the fields on your form and on the target ASP sites login form
$myUsernameKey = "username";
$myPasswordKey = "password";
$targetUsernameKey = "user";
$targetPasswordKey = "pass";

?>
<html>
    <head>
        <title>Please wait....</title>
    </head>
    <body>

        <form id="redirect-form" action="http://www.some-asp-site.com/login.asp" method="post" target="_top">
            <input type="hidden" name="<?php echo htmlentities($targetUsernameKey); ?>" value="<?php echo htmlentities($_REQUEST[$myUsernameKey]); ?>" />
            <input type="hidden" name="<?php echo htmlentities($targetPasswordKey); ?>" value="<?php echo htmlentities($_REQUEST[$myPasswordKey]); ?>" />
        </form>
        <script type="text/javascript">
            setTimeout(function() { document.getElementById('redirect-form').submit(); },100);
        </script>
    </body>
</html>

If you don't want your user to ever see this redirect page you can use javascript to load this code in a 1x1 CSS transparent iframe when the user clicks login, adding the username and password to the query portion of the URL. The target="_top" will cause the web page to be redirected instead of the iframe.

[edit] libcurl will not help in this situation unless you plan on creating a service like anonymouse where the user never actually leaves your site. In that case you can apply filters to the web pages retrieved with curl to fill in forms before they are displayed to the user.

respondido 29 nov., 13:11

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.