Please help me to see, I use the curl function to simulate the transfer of parameters between the page, but after the test found that parameters are always not delivered to the specified page, please help me analyze, My code attached:
Header ("content-type:text/html; Charset=utf-8 ");
Include ("basic-lanconf.php");
echo "--------------------Basic-lan configuration Results-------------------";
echo "-------------------------------------------------------
";
echo "(1). Basic-lan Configuration Test results:
";
$url = "http://192.168.0.1/tomato.cgi";
$head =array ();
$head []= "Authorization:basic". Base64_encode ($admin. ":". $pass);
$curlPost = "Lan_ipaddr= $lan _ipaddr&lan_netmask= $lan _netmask&f_dhcpd_enable= $f _dhcpd_enable".
"&dhcpd_startip= $dhcpd _startip&dchpd_endip= $dchpd _endip&dhcp_lease= $dhcp _lease";
$ch = Curl_init ($url);
curl_setopt ($ch, Curlopt_url, $url);
curl_setopt ($ch, curlopt_useragent, $_server[' http_user_agent ');
curl_setopt ($ch, curlopt_header,0);
curl_setopt ($ch, curlopt_returntransfer,0);//requires the result to be saved to a string or output to the screen with a parameter of 1 and not returned to the screen
curl_setopt ($ch, Curlopt_httphrader, $head);
curl_setopt ($ch, curlopt_post,1);
curl_setopt ($ch, Curlopt_postfields, $curlPost);
$data =curl_exec ($ch);
Curl_close ($ch);
echo "Data= $data
";
echo "Lan-ipaddr= $lan _ipaddr
";
echo "lan-netmask= $lan _netmask
";
echo "F_dchpd_enable= $f _dhcpd_enable
";
echo "dhcpd_startip= $DHCPD _startip
";
echo "dhcpd_endip= $DHCPD _endip
";
echo "Dhcp_lease= $dhcp _lease
";
?>
Reply to discussion (solution)
$url = "http://192.168.0.1/tomato.cgi";?
Do you know what kind of data he needs to accept?
Start with a PHP program to test
$url = "http://192.168.0.1/tomato.cgi";?
Do you know what kind of data he needs to accept?
Start with a PHP program to test
He is a tomato brush router wrt, it is difficult to change the PHP test, hehe