Home >Backend Development >PHP Tutorial >PHP calls IE execution program

PHP calls IE execution program

WBOY
WBOYOriginal
2016-07-28 08:26:361155browse
<span><span><?php</span><span>/* just copied six lines below ... */</span><span>$Browser</span> = <span>new</span> COM(<span>'InternetExplorer.Application'</span>);
<span>$Browserhandle</span> = <span>$Browser</span>->HWND;
<span>$Browser</span>->Visible = <span>true</span>;
<span>$f1_url</span> = <span>"http://**.com/def.php"</span>;
<span>$Browser</span>->Navigate(<span>$f1_url</span>);
sleep(<span>5</span>);

<span>/* $allforms is NOT an array ... it is an iterator ... */</span><span>$allforms</span> = <span>$Browser</span>->Document->getElementsByTagName( <span>'form'</span> );

<span>/* current() is not implemented ... so we have to run a loop ... */</span><span>foreach</span>( <span>$allforms</span><span>as</span><span>$theform</span> ) {

    <span>/* i also copied these six lines and did some text replace work ... */</span><span>$theform</span>->id->focus();
    <span>$theform</span>->id->value = <span>"username"</span>;
    <span>$theform</span>->pwd->focus();
    <span>$theform</span>->pwd->value = <span>"password"</span>;
    <span>$theform</span>->action->focus();
    <span>$theform</span>->action->click();
    
}

<span>/* bye browser ... have a nice day ... */</span><span>$Browser</span>->Quit();</span></span>

The above introduces how PHP calls IE execution program, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn