Automate Field Entry in outside site
I am attempting to automate the entry of data into form fields. The problem is that this data (user/pass) is not known by the user. I'm not expressly hiding it from them, but they also don't need to know it.
This is used to automate logins on several of our outside partner websites, who do not want our agents knowing their passwords. Sadly, most of these sites do not have any APIs I can work with... so I have to get the user logged in.
I tried using an iframe and javascript, but I ran into the issue of security permissions denying it access. And sadly, our clients do not have access to add our domain to their sites(they seem to be 3rd party).
Requirements: - Display webpage - Automatically enter data into fields
Would be nice: - Automate signin similar to form.submit() - Flash/AJAX support. These seem to give th开发者_如何转开发e VB app issues.
Is there a way to do this via javascript/html, and if not, do you have any recommendations for C#/php/asp.net options?
PS: I am not sure what this techinque is called, so google isn't helping me it seems. Please set me straight on the terminology of what I am actually trying to accomplish.
Your best bet here might be to build a proxy to the applications in question. Your C# code should request the URL from the remote server (sending any postdata) and then display the result to your users. That way, your users interact with the proxy app you're building and you can then manipulate the pages using JavaScript, and even server side do things like replacing
<input type="text" name="username">
with
<input type="hidden" name="username" value="some-user">
What if you send them a unique ID (linked to a specific user) instead of a username and password that they use to log in? That way it's "safe" for the outside word if you don't know a key, and those users don't have any knowledge about their actual username/password.
Something like: http://yourdomain.com/login.php?key=12345ABCD678
.
Or nicer, with a mod_rewrite
: http://yourdomain.com/login/12345ABCD678
.
In your login script, $_GET
that ID, retrieve the user/pass from the database with your language of choice, and proceed with the login.
I think you'll want to do this using some sort of server side language using cURL.
There is an implementation of cURL in just about every language I think, one of the most popular is however PHP's implementation.
I think this might be the missing piece to your puzzle.
精彩评论