HTML-using PHP to call com "internetexplorer.application", how do I use the name attribute to impersonate a user login?

Source: Internet
Author: User
I have a sample form code for the login page (http://**.com/def.php) page:

I called com "internetexplorer.application" by PHP to fill out the form and log in, the code is as follows:

 
  HWND; $Browser->visible = true; $f 1_url = "http://**.com/def.php"; $Browser->navigate ($f 1_url); sleep (5); $ Browser->document->f_action->id->focus (); $Browser->document->f_action->id->value = " Username "; $Browser->document->f_action->pwd->focus (); $Browser->document->f_action->pwd- >value = "password"; $Browser->document->f_action->action->focus (); $Browser->document->f_ Action->action->click (); $Browser->quit ();? >

It is in the name attribute to find the element to be controlled, but if I change the form code of the sample page to:

I called com "internetexplorer.application" by PHP to fill out the form and log in, the code is as follows:

 
  HWND; $Browser->visible = true; $f 1_url = "http://**.com/def.php"; $Browser->navigate ($f 1_url); sleep (5); $ Browser->document->f_action->id->focus (); $Browser->document->f_action->id->value = " Username "; $Browser->document->f_action->pwd->focus (); $Browser->document->f_action->pwd- >value = "password"; $Browser->document->f_action->action->focus (); $Browser->document->f_ Action->action->click (); $Browser->quit ();? >

It is in the name attribute to find the element to be controlled, but if I change the form code of the sample page to:

 
  

Change "name=" f_action "" to " No Name attribute ", so how can the PHP code be rewritten in order to allow COM "internetexplorer.application" to fill out the form and log in?

Thank!

These two days, the net answer to the DOM-related questions ... I don't know why ...

The amount ... The above is an off-topic ... You have this problem ... If you can write it here ... It should not be difficult to move on ...

Programming in addition to rigorous ... Sometimes in the face of the problem do not know also need to imaginative imagination and not afraid of the wall of the attempt ...

 
  HWND; $Browser->visible = true; $f 1_url = "http://**.com/def.php"; $Browser->navigate ($f 1_url); sleep (5);/* $ AllForms is isn't an array ... it's an iterator ... */$allforms = $Browser->document->getelementsbytagname (' form ');  /* Current () was not implemented ... so we had to run a loop ... */foreach ($allforms as $theform) {/    * I also copied These six lines and did some text replace work ... *    /$theform->id->focus ();    $theform->id->value = "username";    $theform->pwd->focus ();    $theform->pwd->value = "password";    $theform->action->focus ();    $theform->action->click ();    } /* Bye browser ... has a nice day ... */$Browser->quit ();

In fact you can handle all the elements on the page ... This is the truth ...

nn ... That's it.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.