Greetings - I've spent quite a bit of time reading and searching around trying to get the wikipedia full text feature functioning as it does so well on here: http://geonames.edesign.no/examples/wikipediafulltext
Any help would be much appreciated - I've tried the coding examples listed on the edesign website and 2/3 work, so I think that the module is installed correctly. I'm trying to get this to run as simply as possible here, so any help in modifying this code to get it to work would be wonderful.
Right now I've got the following code:
<form method=get>
Search <input name=query type=textfield>
<input type=submit>
</form>
<?
$query = $_GET['query'];
$result = geonames_query('wikipediasearch', $query);
foreach ($result->results as $value) {
echo $value;
}
?>
I'm getting an error off the bat "warning: Invalid argument supplied for foreach()" which I can't quite figure out, and have tried many different way to get the results out of $result.
Any help to get me over this hump would be great. Thanks!
Mike
Comments
Comment #1
2xe commentedYou'll get that error when you try to traverse a variable that is not an object or array. 1. make sure you have an input string ($query) and 2. make sure you have a result. Try adding: