0

API and Concurrency

Hello, I am wondering how to implement concurrent scripts, i.e. pulling information from Facebook, twitter, local weather, etc. while I connect the call. I can write a little bit Javascript and PHP, maybe I'm in the wrong language to do that ;) I have basically two obstacles: 1/ API calls such as "say" or "call" only come back after the command succeded, failed, or timed out, etc. That means that all "gathering" of information needs to happen before. I can play a WAV file during "transfer", but that would have to be created on the fly. I didn't look around yet, but I guess I need a text-to-WAV webservice (now there's an opportunity ;)) Also: the WAV file needs to be completely computed before I can transfer the call, as there is no 'streaming' during "transfer"... 2/ I'd like to query a couple of websites for information (twitter, facebook, some databases, etc.). Obviously a couple of sites might take longer to respond or fail. From what I know, PHP and javascript are basically "serial" languages, but PHP CURL is capable of event handlers, I think. I could create event handler and wait for let's say 10 seconds, and after that assemble the data for "say" and ignore all further events, but isn't there a better way? Cheers, Thorsten

18 comments

Please sign in to leave a comment.