Hello again,
I've spent a bit of time looking through the JavaScript documentation, PHP documentation, and the API documentation but haven't been able to get any kind of return data from the API. I started by trying to use the example Roan provided in JavaScript and learned a bit more about function usage in JavaScript, but I'm still getting nothing back from wiktionary. Could someone provide me with a simple, working example that actually returns a value?
I've tried a number of different things, including the get_file_contents in PHP (which did echo a barebone representation of the page I loaded), but I've reverted back to the example Roan provided. Again, I'm trying to get the definition for a dynamically submitted word. Any parse-able format with the definition would work fine.
Here's the example I've been working with. The function works in either script block and I have moved it around trying to get the callback to actually DO something. So far, nothing happens.
<html> <body> <script type="text/javascript" src=" http://en.wiktionary.org/w/api.php?format=json&callback=myFunc&action=opensearch&search=play "> function myFunc(str){ document.write(str); document.write("Hrm"); } </script>
<script type="text/javascript" > //myFunc("hello"); </script> </body> </html>
Thanks again, Aaron.
On Wed, Jun 9, 2010 at 4:42 PM, Roan Kattouw roan.kattouw@gmail.com wrote:
2010/6/10 Aaron Ward edugamer@gmail.com:
Alternatively, I was wondering if it might be possible to set my server
up
as a sort of proxy to go between Wiktionary and the Flash program. If I
can
use PHP, JavaScript, or HTML to query the WMF database and retrieve the desired definition, then I should be able to forward that information on
to
the game that requested it using my own cross-domain-policy.
This is probably the best solution.
Roan Kattouw (Catrope)
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api