Commit d3302955 authored by arnaudbey's avatar arnaudbey
Browse files

add defs method

parent 21007769
/vendor/
<?php
namespace Innova\WiktionaryBundle\Manager;
class WiktionaryManager
{
public function __construct()
{
}
public function getDefinitions($lemma, $language)
{
$url = 'https://'.$language.'.wiktionary.org/wiki/'.$lemma;
$handle = @fopen($url, 'r');
$def = 'Oups...';
if ($handle) {
while (!feof($handle)) {
$def = stream_get_contents($handle);
}
fclose($handle);
}
return $def;
}
}
......@@ -2,3 +2,5 @@ services:
# innova_wiktionary.example:
# class: Innova\WiktionaryBundle\Example
# arguments: ["@service_id", "plain_value", "%parameter%"]
innovalangues_wiktionary:
class: Innova\WiktionaryBundle\Manager\WiktionaryManager
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment