Noob question about PHP Curl

Status
Not open for further replies.

mixmax

Active Member
25
2010
0
0
Hi everyone,
This is just a noob question.
I'm wondering if PHP Curl can run asynchronously or run in background?
I'm developing a script for Wordpress plugin and fire when publish a post.
When publish a post, it will fire another script with curl.
But the other script take a very long time to finish, and Wordpress waiting for it.
So i need some advice from you guys how to run it in background.
Thanks everyone. I like this forum. WJ rocks!
 
2 comments
Firstly you should understand that PHP Processor runs on a single thread, soi you can perform task's without taking advantage of other methods.


The method I would do is pinger.

within you code you should insert the post into the database and get the ID and do

PHP:
$src = fopen('some text file','a+');
fwrite($id,$src);
fwrite(',',$src);
fclose($src);

So that you can write the id to a directly, then you set up a cron system to run every hour, and the PHP page executed by cron would open up the text file and read the id's and select them from database to be sent elsewhere.
 
Thanks litewarez.
Finally i manage to get it working.
I'm using:
ignore_user_abort(true);
set_time_limit(0);
and output buffering.
 
Status
Not open for further replies.
Back
Top