Просмотр поста

.
Rakovskiy
The Fast, Secure and Professional - Yii2
# kiberpank (01.06.2014 / 11:54)
когда будешь за пк?
На доноре ссылки идут вида http://iceload.ru/films/info/id фильма/ ты парсишь http://iceload.ru/films/
Получается тебе нужно заменить ссылки с донора,что бы они имели вид ?act=info/id фильма/ и изменить урл сайта донора на такой http://iceload.ru/films/ . $act
То есть
curl_setopt ($ch , CURLOPT_URL , "http://iceload.ru/films/"); //копируем HTML код страницы

заменит на
curl_setopt ($ch , CURLOPT_URL , "http://iceload.ru/films/" . $act); //копируем HTML код страницы


Ссылки можешь заменить следующим образом
$content = str_replace('<a href="http://iceload.ru/films/"','<a href="?act=',$content);


И должен получиться такой вариант

define('_IN_JOHNCMS', 1);
$textl = 'test';
require_once('../incfiles/core.php');
require_once('../incfiles/head.php');
$ch = curl_init ();
curl_setopt ($ch , CURLOPT_URL , "http://iceload.ru/films/" . $act);
curl_setopt ($ch , CURLOPT_USERAGENT , "Mozilla/5.0 (Windows; U; Windows NT 6.1; ru-RU; rv:1.7.12) Gecko/20050919 Firefox/1.0.7"); //типа мы делаем это из мозиллы
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$content = curl_exec($ch); //Записываем награбленное в $content
curl_close($ch);
iconv("windows-1251","utf-8", $content);
$content = str_replace('<?xml version="1.0" encoding="utf-8"?>',' ',$content);
$content = preg_replace('#<head>(.*)</head>#sU','',$content);
$content = preg_replace('#<!DOCTYPE(.*)<div class="title">(.*)</div>#sU','',$content);
$content = preg_replace('#<div class="main">(.*)</div>#sU','',$content);
$content = preg_replace('#<sсript>(.*)</sсript>#sU','',$content);
$content = preg_replace('#<div class="foot">(.*)</div>#sU','',$content);
$content = str_replace('<a href="http://iceload.ru/films/','<a href="?act=',$content);
echo $content;
require_once('../incfiles/end.php');