Click here to Skip to main content
15,893,668 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi!
I've been struggling with trying to submit a form on a page on my localhost to another website. This is the form code on the site I want to login to:

JavaScript
    <form name="login_ams_form" id="login_ams_form" method="post">
    <input type="text" name="username" id="login_username">
    <input type="password" name="password" id="login_password">
    <input type="text" name="company" id="login_company">
     <div align="right" style="margin-removed22px">
     <div style="float:right; margin-removed5px">
     <a >Reset</a>
</div>
<div style="float:right" id="login_button">
<a >Login</a>
                            </div>
                            <div style="float:right; display:none; margin-removed10px; margin-removed10px" id="login_loading">
                                <img src="img/loading.gif" width="32" height="32">
                            </div>
                            <div class="clearfix"></div> 
                        </div>
                    </form>


I see that the submit action checks a function on a javascript file. So i'm trying to reference that js file in my own html file which i want to use to login.

This is what i've tried so far:

<html>
  <head><script src="http://www.thedomain.co.za/js/functions.js"></script> </head>

                  <h3>Login to AMS</h3>
                     <form action="http://www.thedomain.co.za/index.html" "name="login_ams_form" id="login_ams_form" method="POST">
       <input type="text" name="username" id="login_username" />
       <input type="password" name="password" id="login_password" />
       <input type="text" name="company" id="login_company" />
                      <input type="submit" onClick="checkLoginams()" >
                                                  </form>
    </html>


My code is being stripped when i post it here, but the login button has an onclick javascript function called checkloginams

When I do this I get the following error : "405 - HTTP verb used to access this page is not allowed."
What am I doing wrong? I had previously tried using cURL to login, which worked but I couldn't login through cURL and then open the actual external site I logged into so I reverted back to trying this. Any assistance would be greatly appreciated! :)
Posted
Updated 15-Nov-15 22:08pm
v5
Comments
F-ES Sitecore 16-Nov-15 4:06am    
The "action" for your form is probably wrong, you rarely submit a form to an html page.
aruban 16-Nov-15 5:49am    
Oh I see. I see the following files being called when i check the requests on the browser: ajax-login-ams.php
login-validate-ams.php
login-validate.php
login-main.php

I dont know which one to submit the form to.
F-ES Sitecore 16-Nov-15 5:58am    
Ask the person whose site you're trying to automate how you can fulfil this task.
aruban 16-Nov-15 6:04am    
I wish i could but that wont be possible. Thanks though :)
F-ES Sitecore 16-Nov-15 6:13am    
So you're asking for help to do something that is unethical?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900