Multithreads

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
azteck
Forum Newbie
Posts: 2
Joined: Wed Jul 30, 2003 6:19 pm

Multithreads

Post by azteck »

HI.I have a script that conects to some webpages and extract some data from there.But it takes too long to receive data.So I was wondering if is possible to have something like a multithreas system in php.It is only one script, and ca't use tmporary files or databases.
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

Optimizing the code for speed is your best bet.
User avatar
trollll
Forum Contributor
Posts: 181
Joined: Tue Jun 10, 2003 11:56 pm
Location: Round Rock, TX
Contact:

Post by trollll »

Aw, shucks. I had hoped someone had written something more like,"Well, they haven't really documented it, but you can multithread by following this pattern:..."

Sigh...

I guess our only hope for multithreading lies in the hands of those who contribute to the PHP/Java integration.
User avatar
Stoker
Forum Regular
Posts: 782
Joined: Thu Jan 23, 2003 9:45 pm
Location: SWNY
Contact:

Post by Stoker »

simple caching of the other site(s) or periodic snapshots created by a cron job...

Threading and forking is a bit more advanced that what PHP can do (AFAIK), you could make some executables (CGI interfaced) for that..
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

That could work also. But it's a very complicated task. ;)
azteck
Forum Newbie
Posts: 2
Joined: Wed Jul 30, 2003 6:19 pm

Post by azteck »

Thank you all:)
I made something like this for other script that needed speed:
I had the links that must be checked in a database.Then I used soemthing like a Fork systemMy php script autoexecuted himself, so i could run let's say about 10 threadds.But It was a strange approach :) so i forget about it.
Post Reply