|
|
|
|
$content1 = file_get_contents("http://www.tenderer.ru/tenders/9/tender277087.html");
$pos = strpos($content1, "<br>
</td></tr></table>");
$content = substr($content1, $pos);
$pos = strpos($content, " </div> </div><br><br>");
$content = substr($content, 0, $pos);
echo $content;
|
граббит. но ко всему нужно авторизоваться.
$hostname = "www.tenderer.ru";
$path = "/login.php"; // Аккуратнее с именами и путями
$line = "";
// Устанавливаем соединение, имя которого
// передано в параметре $hostname
$fp = fsockopen($hostname, 80, $errno, $errstr, 30);
// Проверяем успешность установки соединения
if (!$fp) echo "$errstr ($errno)<br />\n";
else
{
// Данные HTTP-запроса
$data =
"login=".urlencode("avtoreg")."&password=".urlencode("123456")."\r\n\r\n";
// Заголовок HTTP-запроса
$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\r\n";
// Отправляем HTTP-запрос серверу
fwrite($fp, $headers.$data);
// Получаем ответ
while (!feof($fp))
{
$line .= fgets($fp, 1024);
}
fclose($fp);
}
echo $line;
не могу залогиниться. подскажите как делать? | |
|
|