Sub5
Новичок
Здравствуйте. У меня тоже проблемы с &
Index.php
<?php
$content = file_get_contents('https://res.ru/news.aspx?network=1000000666292');
$pos = strpos($content, '<ul class="news">');
$content = substr($content, $pos);
$pos = strpos($content, '</ul>');
$content = substr($content, 0, $pos);
$content = str_replace('https://res.ru/news.aspx?network=','http://test.ru/proba/parser.php?p=https://res.ru/news.aspx?network', $content);
echo $content;
?>
После перехода по любой ссылки с контента в адресной строке браузера отображается:
http://test.ru/proba/parser.php?p=http://res.ru/news.aspx?network=1000000666292&news=1384930
Но контент остается прежним : https://res.ru/news.aspx?network=1000000666292
parser.php
<?php
if(!empty($_GET))
{
$url = htmlspecialchars (strtolower(trim($_GET['p'])));
}
$content = file_get_contents($url);
$pos = strpos($content, '<ul class="pen">');
$content = substr($content, $pos);
$pos = strpos($content, '</ul>');
$content = substr($content, 0, $pos);
echo $content;
?>
Помогите, пожалуйста, с решением & и если есть возможность подправьте код.
Index.php
<?php
$content = file_get_contents('https://res.ru/news.aspx?network=1000000666292');
$pos = strpos($content, '<ul class="news">');
$content = substr($content, $pos);
$pos = strpos($content, '</ul>');
$content = substr($content, 0, $pos);
$content = str_replace('https://res.ru/news.aspx?network=','http://test.ru/proba/parser.php?p=https://res.ru/news.aspx?network', $content);
echo $content;
?>
После перехода по любой ссылки с контента в адресной строке браузера отображается:
http://test.ru/proba/parser.php?p=http://res.ru/news.aspx?network=1000000666292&news=1384930
Но контент остается прежним : https://res.ru/news.aspx?network=1000000666292
parser.php
<?php
if(!empty($_GET))
{
$url = htmlspecialchars (strtolower(trim($_GET['p'])));
}
$content = file_get_contents($url);
$pos = strpos($content, '<ul class="pen">');
$content = substr($content, $pos);
$pos = strpos($content, '</ul>');
$content = substr($content, 0, $pos);
echo $content;
?>
Помогите, пожалуйста, с решением & и если есть возможность подправьте код.