I wanna get definition and meaning from another website, the website doesn't have an API....when I curl it, I get the whole page instead of just a few lines.
This is my code:
<TD align=center> <form action="http://www.nigeriandictionary.com/all_word.php?lang_id=68&word=love" method="get">
<input type="hidden" name="word_search" value="true">
<table border="0" align="center" cellpadding="5" cellspacing="0" class="special" bgcolor=#fdfdfd width=100%>
<tr>
<td> <FONT COLOR="#330099"><B>Search the dictionary
</B></font><BR>
<input name="word" type="text" value="" size="50" maxlength="50">
<input name="submit" type="submit" value="Search">
<BR> </td>
</tr>
</table>
</form></TD>
Php code:
<?php
// asumption
$_POST['search'] = "love";
// Return Search Result
echo curlpage($_POST['search']);
function curlpage($keyword) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://www.nigeriandictionary.com/all_word.php?lang_id=68&word=' . urlencode($keyword) . '&');
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FILETIME, true);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
?>
And this is what I want it to do :
This Curl will return the whole webpage, the problem I have is not showing a small box like this:
<div id="rtere-yoruba">
<p>Word: Love </p>
<p>Definition: To have affection for someone...</p>
</div>