Keith Devens .com |
Saturday, March 20, 2010 | ![]() |
| Crying is all right in its way while it lasts. But you have to stop sooner or later, and then... – C.S. Lewis (The Silver Chair, ch 2) | ||
|
| ← Spaces | To whom it may concern → |

Phillip Pearson (http://www.pycs.net/devlog/) wrote:
Aaron of Montreal (http://www.aaronland.net) wrote:
use WebService::weblogUpdates; WebService::weblogUpdates->new(transport=>"XMLRPC")->rssUpdate({name=>"foo",url=>"bar"});
Martin (http://traumwind.tierpfad.de/blog/) wrote:
Cool man, it works like a charm. But now there's only one gripe with this: the post takes quite a while longer to return to the user, as the PHP needs to go to weblogs.com first... Any ideas how one could do this 'asynchronously'?
Keith (http://www.keithdevens.com/) wrote:
Yeah, I wish I knew. If my stuff was in Java I'd spawn off a thread and forget about it. Best I can imagine is to create a separate file to do my pinging, and call that file with a system call, which, depending on which way I call it from PHP, can run asynchronously. However, then you don't get to see the ping output. It really does take a while to ping, unfortunately, and I haven't come up with a good solution.
Martin (http://traumwind.tierpfad.de/blog/) wrote:
/me slaps head to forehead....
I had something like this up and running some time ago, to implement a kind of cron w/o access to actual cron-jobs (PHP only account w/o shell)
The main idea was to simply open an http-request to a given PHP script, and simply NOT wait for it to return. That script of course would need to write messages to some kind of logfile for later inspecion.
The relevant code looks like this:
<pre>function dojob ($url) {
// $url needs to be fully specified http:// type url
global $log;
$fjob = @fopen($url,"r");
if (! $fjob) { fwrite ($log, "\tfailed $url\n"); }
else { fwrite ($log, "\tsuccess $url\n"); }
}
</pre>
If anybody is interested I could publish the whole of dadaCron.php wgich is not really anything...
Feel free to post a comment below. Please see my comment policy.
Formatting Rules (No HTML):
Generated in about 0.118s.
(Used 8 db queries)
Or in Python:
import xmlrpclib; xmlrpclib.Server( 'http://rpc.weblogs.com/RPC2' ).rssUpdate( name, address )
That's how bzero does it.