sprobowałem curl pobrac plik jpg
<?php
$ch = curl_init('http://odsiebie.com/captcha.php');
$fh = fopen('plik.jpg', 'w'); curl_setopt($ch, CURLOPT_FILE, $fh);
curl_exec($ch);
curl_close($ch);
?>
plik się ładnie zapisuje ale nadal bez niczego
czy możecie mnie naprowadzić może jak zrobić to (tzn utrzymać sesję z serwera?)
w skrypcie
wchodze na link imituje naciśniecie przycisku i przechodze do weryfikacji
lecz po wyprintowaniu strony obrazek jest pusty:(
robię to tak
<?php
$page = geturl($Url["host"], $Url["port"] ? $Url["port"] : 80, $Url["path"].($Url["query"] ? "?".$Url["query"] : ""), 0, 0, 0, 0, $_GET["proxy"],$pauth);
is_page($page);
?>
a oto te dwie funkcje
<?php
function is_page($lpage)
{
if (!$lpage)
{
html_error("Error retriving the link<br>$lastError", 0);
}
}
function geturl($host, $port, $url, $referer = 0, $cookie = 0, $post = 0, $saveToFile = 0, $proxy = 0, $pauth = 0, $auth = 0, $scheme = "http", $resume_from = 0) {
global $nn, $lastError, $PHP_SELF, $AUTH, $IS_FTP, $FtpBytesTotal, $FtpBytesReceived, $FtpTimeStart, $FtpChunkSize, $Resume, $bytesReceived, $fs, $forbidden_filetypes, $rename_these_filetypes_to, $bw_save, $force_name;
$scheme.= "://";
if (($post !== 0) && ($scheme == "http://"))
{
$method = "POST";
$postdata = formpostdata($post);
$content_tl = "Content-Type: application/x-www-form-urlencoded".$nn."Content-Length: ".$length.$nn;
}
else
{
$method = "GET";
$postdata = "";
$content_tl = "";
}
if ($cookie)
{
{
for( $i = 0; $i < count($cookie); $i++) {
$cookies .= "Cookie: ".$cookie[$i].$nn;
}
}
else
{
$cookies = "Cookie: ".$cookie.$nn;
}
}
$referer = $referer ? "Referer: ".$referer.$nn : "";
if ($scheme == "https://")
{
$scheme = "ssl://";
$port = 443;
}
if($proxy)
{
list
($proxyHost, $proxyPort) = explode(":", $proxy); $url = $scheme.$host.":".$port.$url;
$host = $host.":".$port;
}
if ($scheme != "ssl://")
{
$scheme = "";
}
$http_auth = ($auth) ? "Authorization: Basic ".$auth.$nn : "";
$proxyauth = ($pauth) ? "Proxy-Authorization: Basic ".$pauth.$nn : "";
$request=
$method." ".str_replace(" ", "%20", $url)." HTTP/1.1".$nn. "Host: ".$host.$nn.
"User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14".$nn.
"Accept: */*".$nn.
"Accept-Language: en-us;q=0.7,en;q=0.3".$nn.
"Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7".$nn.
"Pragma: no-cache".$nn.
"Cache-Control: no-chache".$nn.
($Resume["use"] === TRUE ? "Range: bytes=".$Resume["from"]."-".$nn : "").
$http_auth.
$proxyauth.
$referer.
$cookies.
"Connection: Close".$nn.
$content_tl.$nn.$postdata;
//write_file(CONFIG_DIR."request.txt", $request);
$fp = @fsockopen($proxyHost ?
$scheme.$proxyHost : $scheme.$host, $proxyPort ?
$proxyPort : $port, $errno, $errstr, 15
); ?>