php function grab url http mobfilms su ch curl_init curl_setopt_array

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
<?php
function grab($url = 'http://mobfilms.su')
{
$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_URL => $url . $_SERVER['REQUEST_URI'],
CURLOPT_RETURNTRANSFER => true,
CURLOPT_USERAGENT => $_SERVER['HTTP_USER_AGENT']
));
$data = curl_exec($ch);
curl_close($ch);
$data = preg_replace('/(src=")/', "$0{$url}/", $data);
$data = preg_replace('/([^a] href=")/', "$0{$url}/", $data);
return $data;
}
echo grab();