AKB Forums

Go Back   AKB Forums > Technical sections > Languages, Compilers and Interpreters > Web Development
Home Register Blogs FAQ Members List Calendar Downloads Arcade Mark Forums Read

Web Development Java/PHP/Perl/ASP and more

Troubles when posting message? Click here! :: Проблемы с отправлением сообщения? Нажмите сюда!

Reply
 
LinkBack Thread Tools Display Modes
Old Oct 24, 2003, 14:27   #1
Младенец
 
di0phantus's Avatar
 
Join Date: May 2002
Location: Yerevan, RA
Posts: 58
Rep Power: 0
Reputation: 10
Открыть Url ресурс через прокси...

Вот небольшой скриптик, который
скачает парочко манга прелестей
PHP Code:
<?PHP

 $folder 
"hentai_01";
    
 
$url_prefix "http://www.hentai.ag/hentaibilder/$folder/bilder_gross/";

@
mkdir("hentai");


for (
$i 2$i<3$i++) {
    
$file_name = ($i<10?"0":"") . "$i.jpeg";

    echo 
"reading file $file_name ...";
    if (!(
$content = @file_get_contents($url_prefix.$file_name))) {
        echo 
"\nproblems reading file $url_prefix$file_name\n";
        continue;
    }

    
    echo 
"OK\nWriting to file...\n";
    
$handle fopen("./hentai/".$file_name"w");
    
fwrite($handle$content);
    
fclose($handle);
    echo 
"DONE\n\n";
}
     

?>
однако есть небольшая проблема...

никак не могу заставить скачать все это через прокси сервер..
пробывал так..
PHP Code:
<?PHP

 $folder 
"hentai_01";
    
 
$url_prefix "http://www.hentai.ag/hentaibilder/$folder/bilder_gross/";
 
$proxy_server "http://our-proxy:8888/";

@
mkdir("hentai");


for (
$i 2$i<3$i++) {
    
$file_name = ($i<10?"0":"") . "$i.jpeg";

    echo 
"reading file $file_name ...";
    if (!(
$content = @file_get_contents($proxy_server.$url_prefix.$file_name))) {
        echo 
"\nproblems reading file $proxy_server$url_prefix$file_name\n";
        continue;
    }

    
    echo 
"OK\nWriting to file...\n";
    
$handle fopen("./hentai/".$file_name"w");
    
fwrite($handle$content);
    
fclose($handle);
    echo 
"DONE\n\n";
}
?>
в прошлий раз целых 13мб скачал что недопустимо...

может кто то знает как можно это сделать?
заране всем спасибо!
__________________
Все не так уж важно ...
di0phantus is offline   Reply With Quote Quote selected
Old Oct 24, 2003, 17:43   #2
¡no pasaran!
 
dolphin's Avatar
 
Join Date: Mar 2002
Location: localhost
Posts: 538
Rep Power: 7
Reputation: 23
Send a message via ICQ to dolphin
Нифига не понял вопроса [(c) windovz ]

при чем тут 13мб ?
__________________
[ que fors aus ne le sot riens nee ]
dolphin is offline   Reply With Quote Quote selected
Old Oct 27, 2003, 14:35   #3
Младенец
 
di0phantus's Avatar
 
Join Date: May 2002
Location: Yerevan, RA
Posts: 58
Rep Power: 0
Reputation: 10
erku xosqov...
asenq grum em senc ban

$cont = file_get_contents("http://ex.com/image.jpg");

es depqum dirrect kkpni u kqashi (ete iharke ka dirrect connection),
isk ete uzum em cherez proxy server?

mi dzevov pordzel em, indz tvum er vor piti ashxati bayc vrodi chashxatec...
asenq togh proxy-in lini proxy:80
de qani vor proxy-in galis zapros tipa
GET /http://ex.com/image.jpg u eli mi erku param tipa HTTP 1.0 ,....

pordzel ei senc grel

$cont = file_get_contents("http://proxy:80/http://ex.com/image.jpg");
__________________
Все не так уж важно ...
di0phantus is offline   Reply With Quote Quote selected
Old Oct 27, 2003, 18:56   #4
¡no pasaran!
 
dolphin's Avatar
 
Join Date: Mar 2002
Location: localhost
Posts: 538
Rep Power: 7
Reputation: 23
Send a message via ICQ to dolphin
Lightbulb

ты не учитываешь, что будет послан такой запрос:

GET /http://ex.com/image.jpg HTTP/1.0

а не

GET http://ex.com/image.jpg HTTP/1.0

... смотри в сторону fsockopen() и спецификации HTTP
__________________
[ que fors aus ne le sot riens nee ]
dolphin is offline   Reply With Quote Quote selected
Old Oct 29, 2003, 09:50   #5
Moderator
 
Join Date: Mar 2002
Location: Ukraine
Posts: 123
Rep Power: 7
Reputation: 10
di0phantus
RTFM - http://www.php.net/manual/en/function.fopen.php

Code:
$f = urldecode("http://www.test.com/someurl/somepage.php");
$data = fsockopen("proxy.dom", 8080, &$errno, &$errstr);
if( !$data )
{
	echo "proxy not available !";
	fclose($resultfile);
	exit();
}
else
{
	fputs($data,"GET $f \r\n");
	while (!feof($data))
	{
		$fdata = fgets($data,1000);
	}
}
__________________
Життя - це не тільки будні © Nemiroff
hayk is offline   Reply With Quote Quote selected
Old Oct 29, 2003, 12:13   #6
Младенец
 
di0phantus's Avatar
 
Join Date: May 2002
Location: Yerevan, RA
Posts: 58
Rep Power: 0
Reputation: 10
dolphin:

kazhetsya forma zaprosa GET-a (lishnyaya '/') ne vliyaet na rezul'tat, ya probival na localhost-e sdelat' zapros cherez svoj proxy host, (v JBuilder8 est' takoj tool, TCP Monitor on zhe imeet rezhim proxy). kogda ya poprobival cherez etot proxy, to vse proshlo normal'no, url resource tipa http://localhost:8080/http://localhost/image.jpg sdownloadilsya.
trudno skazat' kak povedut sebya drugie normal'nie serveri, mozhet i proignoriruyut a mozhet i net...
a togda do etogo ne doxodilo, okazivaetsya tut u nas -
proxy authorization required!
a u menya pered funkciej stoyala @
$data = @file_get_contents ... vot i prebival ya v neznanii


po pravde govorya ya nadeyalsya chto standartnij wrapper http imeet dopolnitel'nie opcii, tipa postavil bi chto-to poxojoe
$GLOBALS['http.proxy.server'] = 'proxy';
$GLOBALS['http.proxy.port'] = '8080';
$GLOBALS['http.proxy.user'] = 'me';
...
i vse poshlo bi kak po maslu!

nado bi esche poiskat',
ili mozhno pozaimstvovat' bolee gibkij http wrapper u drugix kto uzhe reshil etu problemu,
a v krajnem sluchae napisat'... kak eto predlogaet hayk. spasibo konechno, no etot put' nemnogo dlinnovat, i on stal esche dlinee esli uchitovat' chto mne nado eshe provodit' proxy authorization.. i vse v ruchnuyu.

ya esche poishu, esli naydu chto to stoieshee to dam znat', vse taki ne sovsem uzh bespoleznij vopros
__________________
Все не так уж важно ...
di0phantus is offline   Reply With Quote Quote selected
Old Oct 29, 2003, 13:09   #7
Moderator
 
Join Date: Mar 2002
Location: Ukraine
Posts: 123
Rep Power: 7
Reputation: 10
Смотри это:
HTTP_Request - Provides an easy way to perform HTTP requests. Supports GET/POST/HEAD/TRACE/PUT/DELETE, Basic authentication, Proxy, Proxy Authentication, SSL, file uploads etc.
HTTP protocol client - HTTP client to access Web resources.
Advanced HTTP Client - GET, HEAD, POST methods with a lot of features.
__________________
Життя - це не тільки будні © Nemiroff
hayk is offline   Reply With Quote Quote selected
Old Oct 29, 2003, 14:30   #8
Младенец
 
di0phantus's Avatar
 
Join Date: May 2002
Location: Yerevan, RA
Posts: 58
Rep Power: 0
Reputation: 10
Thumbs up

spasibo, otlichnie site-i :agree:
di0phantus is offline   Reply With Quote Quote selected
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 12:05.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
This board was founded on September 29, 2001
Powered by Viper Internet

Affordable Web Hosting | ParevNet

Buy text link