cURL-sorun olmadan Curl

1 Cevap php

Ben uzak bir sunucudan dosyaları kopyalamak istedim, ama o uzak ana oturumu kullanıyor gibi görünüyor, ve çerezleri gerekiyor.

well I used this method after defining variables...

$url="http://example.com/stamp/stamp.jsp?tp=&arnumber=5255176&isnumber=5255174";
$nn = "\r\n";
$cookies="";
$request = GET . " " . 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  . $proxyauthorization . $referer . $cookies . "Connection: Close";

$fp= socksopen($Proxy,$port, $errno, $errstr, 15 );

socket_set_timeout ( $fp, 120 );

fputs ( $fp, $request );

fflush ( $fp );

//read header

$i = 1;

do {

$header.= @fgets ( $fp, 128 );

$i++;

} while ( strpos ( $header, $nn . $nn ) === false );

echo $header;

fclose ($fp);

şimdi url dedi kurabiye ile başlığı var:

HTTP/1.1 302 Moved Temporarily Content-length: 0 Content-type: text/html Server: Sun-ONE-Web-Server/6.1 Date: Mon, 28 Dec 2009 13:40:53 GMT Set-cookie: ERIGHTS=5YAaxxmNsMuTK87E1TCAohwDRuyqBaCgM-oehmg24bkzHplCtmgn7zMA==;path=/;domain=.example.org Set-cookie: WLSESSION=1528980108.20480.0000; expires=Tue, 29-Dec-2009 13:40:52 GMT; path=/ Location: http://example.com/stamp/stamp.jsp?tp=&arnumber=5255176&isnumber=5255174"&tag=1 Via: 1.1 proxy-server1 Proxy-agent: Sun-Java-System-Web-Proxy-Server/4.

sonra bazı acı kodu yaptım ve kodu bu yili:

$cookies="cookie: ERIGHTS=5YAaxxmNsMuTK87E1TCAohwDRuyqBaCgM-oehmg24bkzHplCtmgn7zMA==,WLSESSION=1528980108.20480.0000";

re-requesting the url with same method mentioned above and again i have got same header with another cookies

Bu uzak web sitesi ilk kez ziyaretçi olarak her zaman beni tedavi ve yeni kurabiye kazanç ayarlar seams

bir şey var, ben kopyalamak için çalışıyorum dosya tamamen bir. pdf dosyası

ben benim tarayıcı tarafından, sonuçlar kontrol:

URL olduğunu söylüyorlar:

http://example.com/stamp/stamp.jsp?tp=&arnumber=5344171&isnumber=5344169

Ben URL kaynak kodunu kontrol ettim, o da iframe ile bir javascript başka bir sayfaya bir yönlendirme içeriyor

(benim tarayıcıdan) sayfanın kaynak

     <frameset rows="65,35%">
<frame src="http://example.com/stamp/banner.jsp" frameborder="0" framespacing="0" framepadding="0" scrolling="no" />
<frame src="http://example.com/stampPDF/getPDF.jsp?tp=&arnumber=5255176&isnumber=5255174" frameborder="0" />

as you see when I click the URL, it redirects me to URL2 the URL2 is this:http://example.com/stampPDF/getPDF.jsp?tp=&arnumber=5255176&isnumber=5255174

url2. pdf dosyası kolayca (indir) kopyalayabilirsiniz içerir.

but when i use my code mentioned above, $url="http://example.com/stamp/stamp.jsp?tp=&arnumber=5255176&isnumber=5255174" it needs cookies to set with my request, when receive cookies and set and send cookies with my request it again replies a new cookie !!

yanlış adamlar nedir?

1 Cevap

Eğer referer olarak http://example.com/stampPDF/getPDF.jsp?tp=&arnumber=5255176&isnumber=5255174 üzerinde geçiyoruz? Site bu kontrol edilebilir.