ChaCha PHP API (1.3 KiB, 347 hits)
ChaCha has finally released an API for their Question and Answer service (documentation here). Personally, I have been waiting for years to get my hands on this data, and today I am happy to share this PHP Class for accessing both questions/answers and trending topics. You will need to register for an API, but the process is quick and painless.
Dump the contents of both the Trends and a Question
$capi = ChaChaAPI('your-key-here');
$answer = $capi->ask("Who is Brandon Corbin?");
$trends = $capi->getTrends();
var_dump($trends);
var_dump($answer);
Output the just the Answer of your question.
$capi = ChaChaAPI('your-key-here');
echo $capi->ask("Who is Brandon Corbin")->qvpResults[0]->answer->answer
GPL. This is offered AS IS, with no guarantees. In fact it might turn your webserver in to a brain eating Zombie that will attack you in your sleep.
ChaCha PHP API (1.3 KiB, 347 hits)
Questions? Ask them in the comments!
Nice little tool, Brandon. Thanks for sharing.
Thanks Omer!
My question is: can we use this to answer questions without actually being on the chacha site? I have being looking for someway to do that for the longest time.