|
|
|
| Здравствуйте!
Подскажите пожалуйста, как отправить данные что б эмулировать нажатие такой кнопки?
<form method="post">
<input type="hidden" name="fform" value="sent" />
<input type="submit" value="Начислить" />
</form>
|
Если отправить вот так:
$hostname = "site.ru";
$path = "/account.php?mod=stats";
$fp = fsockopen($hostname, 80, $errno, $errstr, 3);
if (!$fp) echo "$errstr ($errno)<br />\n";
else
{
$data = "fform=sent";
$headers = "POST $path HTTP/1.1\r\n";
$headers .= "Host: $hostname\r\n";
$headers .= "Content-type: application/x-www-form-urlencoded\r\n";
$headers .= "Content-Length: ".strlen($data)."\r\n";
$headers .= "Cookie: PHPSESSID=f1f3e61775648d603c01f93061f58e61\r\n";
$headers .= "Connection: Close\r\n\r\n";
fwrite($fp, $headers.$data);
while (!feof($fp))
{
$line .= fgets($fp, 1024);
}
fclose($fp);
}
echo $line;
|
то ответ отсерва выглядит вот так
HTTP/1.1 302 Found Date: Sat, 21 Jun 2008 00:19:16 GMT Server: Apache/2.2.4 (Unix) PHP/4.4.7 mod_ssl/2.2.4 OpenSSL/0.9.8a mod_perl/2.0.3 Perl/v5.8.7 X-Powered-By: PHP/4.4.7 Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Location: error.php Content-Length: 0 Connection: close Content-Type: text/html
|
| |
|
|