Показать сообщение отдельно

  #3739  
Старый 29.06.2008, 11:24
Дикс
Познавший АНТИЧАТ
Регистрация: 16.04.2006
Сообщений: 1,488
Провел на форуме:
2209675

Репутация: 537


Отправить сообщение для Дикс с помощью ICQ
По умолчанию

Решил освежить свои знания по подделке запросов к серверу - написал небольшой скрипт на пхп.
PHP код:
<?php
//90.156.158.104 www.litprom.ru
//Connection: Close\r\n\r\n
$fp fsockopen("www.litprom.ru"80$errno$errstr30);
if (!
$fp) {
    echo 
"$errstr ($errno)<br />\n";
} else {

    
$headers "POST /text.phtml?storycode=343 HTTP/1.0\r\n";
    
$headers .= "Host: www.litprom.ru\r\n";
    
$headers .= "User-Agent: Mosaic%200.1b\r\n";
    
$headers .= "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5\r\n";
    
$headers .= "Accept-Language: ru-ru,ru;q=0.8,en-us;q=0.5,en;q=0.3\r\n";
    
$headers .= "Accept-Encoding: gzip,deflate\r\n";
    
$headers .= "Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7\r\n";
    
$headers .= "Keep-Alive: 300\r\n";
    
$headers .= "Connection: keep-alive\r\n";
    
$headers .= "Referer: www.litprom.ru\r\n";
    
$headers .= "Cookie: PHPSESSID=ec8167a0ceae9ed75240f506212889bf; b=b; hotlog=1\r\n";
    
$headers .= "Content-Type: application/x-www-form-urlencoded\r\n";
    
$headers .= "Content-Length: 145\r\n";
    
$headers .= "POSTDATA: login=deex&password=pass&comment=%D0%9C%D0%B8%D1%80%D1%83+%D0%BC%D0%B8%D1%80%21&submit=%C7%E0%F5%F3%E9%FF%F0%E8%F2%FC%21&storycode=343&chapt=1\r\n\r\n";



    
fwrite($fp$headers);
    while (!
feof($fp)) {
        echo 
fgets($fp128);
   }
    
fclose($fp);
}
?>
а он орёт что длина не указана..
у нас тут прокся на работе. может она всё портит?

PHP код:
HTTP/1.0 411 Length Required Serversquid/2.5.STABLE6 Mime-Version1.0 DateSun29 Jun 2008 07:19:49 GMT Content-Typetext/html Content-Length1879 ExpiresSun29 Jun 2008 07:19:49 GMT X-Squid-ErrorERR_INVALID_REQ 0 X-CacheMISS from linux.key-soft.net Connectionclose 
ERROR
The requested URL could not be retrieved

While trying to process the request
GET /text.phtml?storycode=343 HTTP/1.0
Host
www.litprom.ru
User
-AgentMosaic%200.1b
Accept
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: ru-ru,ru;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: www.litprom.ru
Cookie: PHPSESSID=ec8167a0ceae9ed75240f506212889bf; b=b; hotlog=1
Content-Type: application/x-www-form-urlencoded
Content-Length: 145
POSTDATA: login=deex&password=pass&comment=%D0%9C%D0%B8%D1%80%D1%83+%D0%BC%D0%B8%D1%80%21&submit=%C7%E0%F5%F3%E9%FF%F0%E8%F2%FC%21&storycode=343&chapt=1


The following error was encountered: 
Invalid Request 

Some aspect of the HTTP Request is invalid. Possible problems: 
Missing or unknown request method 
Missing URL 
Missing HTTP Identifier (HTTP/1.0) 
Request is too large 
Content-Length missing for POST or PUT requests 
Illegal character in hostname; underscores are not allowed 

Your cache administrator is admin. 
 
Ответить с цитированием