how do they do it?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
eugene2006
Forum Newbie
Posts: 19
Joined: Fri Oct 28, 2005 6:09 pm

how do they do it?

Post by eugene2006 »

http://nntime.com/realtime/

i want to do the same I have lets say
200 socks proxies and all i get is long long wait until my @fsockopen script finishes "for" loop...
how to show real time proccess of socks cheking?
Grim...
DevNet Resident
Posts: 1445
Joined: Tue May 18, 2004 5:32 am
Location: London, UK

Post by Grim... »

I smell AJAX. Do a search for it on this forum.
foobar
Forum Regular
Posts: 613
Joined: Wed Sep 28, 2005 10:08 am

Post by foobar »

...or go straight to the beginner's AJAX Tutorial on devMoz.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post by josh »

Actually it looks like they're just using plain html output and flushing the output buffer, I don't see any hints of AJAX in the page source.
RobertPaul
Forum Contributor
Posts: 122
Joined: Sun Sep 18, 2005 8:54 pm
Location: OCNY

Post by RobertPaul »

I'm with jshpro2 ... there's no JS on the pages, besides that for the ads.
eugene2006
Forum Newbie
Posts: 19
Joined: Fri Oct 28, 2005 6:09 pm

Post by eugene2006 »

jshpro2 wrote:Actually it looks like they're just using plain html output and flushing the output buffer, I don't see any hints of AJAX in the page source.
excuse me, guys, but could you explain it to me how to do it?

i do echo in for loop but no echoes are shown until for loop completely finishes

lets say i have 60 socks proxies to check (fsockopen is timeout 2 seconds) it takes me about 20 seconds to wait and then only html page appreas with a result. but if i would have 2000 socks proxies? it will take ages to load, but i think i wont even get a result because of script execution time out.

so how to check step by step and not to overload server
and how to output real time progress?

please show me an example :oops:
eugene2006
Forum Newbie
Posts: 19
Joined: Fri Oct 28, 2005 6:09 pm

Post by eugene2006 »

guys thank yoy so much for flushing me :)

so sweet to see interactivity :)
just flush();

here is tuts
http://www.icemelon.com/tutorials/20/Ou ... unning.htm
http://www.hudzilla.org/phpbook/read.php/13_9_0
http://ee.php.net/flush
eugene2006
Forum Newbie
Posts: 19
Joined: Fri Oct 28, 2005 6:09 pm

Post by eugene2006 »

Jcart | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]

Code: Select all

for ($x=0;$x<$numsockets;$x++)
{

ob_end_flush();
	$urlInfo[$x] = parse_url($sockets[$x]);
	echo $urlInfo[$x][host].":".$urlInfo[$x][port];	

	$sockets[$x] = @fsockopen($urlInfo[$x][host], $urlInfo[$x][port],$errno, $errstr, 1);
}
guys does this script works one sockset by one? or it is multythreaded?

is there a way to speed it up?


Jcart | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
foobar
Forum Regular
Posts: 613
Joined: Wed Sep 28, 2005 10:08 am

Post by foobar »

eugene2006 wrote:guys thank yoy so much for flushing me :)
Bwahaha!!! Quote of the year! :roll:
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

guys does this script works one sockset by one? or it is multythreaded?
One by one. PHP is a single threaded.
eugene2006
Forum Newbie
Posts: 19
Joined: Fri Oct 28, 2005 6:09 pm

Post by eugene2006 »

one by one is bad. how do i something like multithread or is there another way to speed up my script?
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post by josh »

Not even sure but you could write shell scripts to return the status of a proxy, and call them one by one from exec(). You would have to set the shell scripts to write to a file somewhere and get PHP to not block while waiting for the shell script to run. You'd then gather the info from all the files.
eugene2006
Forum Newbie
Posts: 19
Joined: Fri Oct 28, 2005 6:09 pm

Post by eugene2006 »

sounds complicated :) and not sure hosting gives a shell
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post by josh »

You wouldn't need a shell account, if you can put a php file onto your site you can put a shell script on.

You can write shell scripts in php and call them from other php scripts with exec(), wether or not your host has disabled exec() is the issue
Post Reply