Hello to all,
I am not sure if this is even possible, but if it does I would gratefully appreciate the methods to implement this please.
We accept applications which require action to be taken (I won't go into the boring details) but part of it involves us looking up a provided word to see if it's bad or not. To do this, we use http://urbandictionary.com/ and google's "define:word" to see what it is
This method works fine, but purely as a time saving measure, I wondered if I could get PHP to contact both sites, and give the first definition it presents which I can display on the page?
If there is no definition, then it to state that, or if it's unavailable to say that too, simply so it's not blank.
The "word" we check is basically $row['word']
Any help appreciated, thank you.
If fopen wrappers have been enabled you can get the pages from the remote servers with the file handling functions. Then parse the pages for the data your interested in.
I'm not sure what your specific situation is but it may be much faster and more reliable to just compile your own list of "bad words".
Hi there, thanks for that
We already have our own bad words, but want those definitions too.
Any ideas how to do that? I really have no idea
I'm affraid I don't understand enough about what your trying to do to write any code.
Start by having your script retrieve one of the remote pages. If you have trouble, open a new post to try and resolve whatever issue your having with this.
Once you have the page, read up on the php string handling functions. Look over the content of the page downloaded by the script and find the data you want to pull from it. Once you see what you want you can decide how to use the string functions to isolate the data you want.
Hi there, thanks for your reply
Okay, i'll give that a shot
Basically, the simplest way of putting what I want to try and achieve is for the $row['word'] (whatever that may be) to be defined on both UrbanDictionary.com and Google's "define:word" (where you type that in the search field and it comes up their definitions)
Then for PHP to display those like:
Google Defintion: definition
And as mentioed on my first post, if there's no definition to state that, or if the site isn't contactable, a message about that
The reason I said the 'first' definition from both is because I know there'll likely be lots of each, and we just need the first (which seems to be the most accurate)
Hope this makes a bit more sense
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)