时间:2021-07-01 10:21:17 帮助过:8人阅读
我藉由PHP呼叫COM “InternetExplorer.Application”去填写表单并登入,代码如下:
HWND; $Browser->Visible = true; $f1_url = "http://**.com/def.php"; $Browser->Navigate($f1_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(); ?>
里面是藉由Name属性找到要控制的元素,但若是我将范例页面的表单代码改成:
我藉由PHP呼叫COM “InternetExplorer.Application”去填写表单并登入,代码如下:
HWND; $Browser->Visible = true; $f1_url = "http://**.com/def.php"; $Browser->Navigate($f1_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(); ?>
里面是藉由Name属性找到要控制的元素,但若是我将范例页面的表单代码改成: