有一个我想通过Guzzle远程连接的特定站点。用户名和密码字段不带名称的问题。
我的问题是:
我的代码:
Login.php
<?php
require("master/guzzle/vendor/autoload.php");
$username = "abc";
$password = "123456";
$client = new \GuzzleHttp\Client();
$response = $client->post('https://www.exmaple.com/login', [
'body' => [
'username' => $username,
'password' => $password,
'action' => 'login'
],
'cookies' => true
]
);
echo $response;
?>
example.com/login
<form>
<div class="login-name">
<div data-nep="Label" class="name-font default neptune_block_15yk4 neptune_LABEL-STANDARD_1h3i4">Username
<div class="neptune_fade-after_15yk4"></div>
</div>
<div data-nep="TextBox">
<input type="text" placeholder="" value="" class="neptune_default_1jbvk" style="height:30px">
</div>
</div>
<div class="login-name">
<div data-nep="Label" class="name-font default neptune_block_15yk4 neptune_LABEL-STANDARD_1h3i4">Password
<div class="neptune_fade-after_15yk4"></div>
</div>
<div data-nep="TextBox">
<input type="password" placeholder="" value="" class="neptune_default_1jbvk" style="height:30px">
</div>
</div>
</form>