Mam taki problem z skryptem. Jest to bot do rapidshare, generuje on directlink do pobierania i wywołuje wgeta do pobrania go. Z tym właśnie jest problem, zamiast pobierać się zawartość pobiera się tylko strona z błędem. Jeśli uruchomię ręcznie wgeta z tym wygenerowanym linkiem w konsoli, to działa i odrazu się pobiera.
Ma ktoś jakiś pomysł?
Załączam kod:
<?
function get_content($url)
{
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_exec ($ch);
curl_close ($ch);
return $string;
}
$content = get_content ("htt://rapidshare.com/files/32805773/test.avi.html");
$action = preg_match('<form action="(.+?)" method="post">', $content, $matches); $matches = $matches[0];
$action = substr($matches, 13
, -15
);
$curl = curl_init($action);
curl_setopt($curl, CURLOPT_FAILONERROR, 1);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_TIMEOUT, 50);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, 'dl.start=Free');
$r = curl_exec($curl);
curl_close($curl);
$x = preg_match('<form name="dlf" action="(.+?)" method="post">', $r, $link); $link = substr($link[0
], 24
, -15
);
$komenda = "wget $link";
?>