我试图通过curl访问路由器的接口,但是我是新编码员,因此我很难做到这一点。
<?php
$data = array( "User name" => "admin", "password" => "*****", "form" => "submit" );
// Initialized the cURL session with Target URL
$ch = curl_init("192.168.8.1");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, "true"); // Allow redirections
curl_setopt($ch, CURLOPT_POST, true); // We are making a post request
/*curl_setopt($ch, CURLOPT_POSTFIELDS, $data);*/
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, "true");
$result = curl_exec($ch);
curl_close($ch);
echo $result;
?>