1

I tried to access the wordnet dictionary as mentioned in: Calling wordnet from php (Wordnet class or API for PHP). It worked fine through command line. Then I tried to use the php function shell_exec() as below to access the dictionary:

<?php 

$output=shell_exec("\Program Files (x86)\WordNet\2.1\bin\wn");
echo $output;
?>

This displays the search option like -ant, -hyp, and so on.i.e it worked fine

But when I tried to add the search option in the above command(as below) it did not work:

<?php 

$output=shell_exec("\Program Files (x86)\WordNet\2.1\bin\wn star -synsn");
echo $output;
?>

or even when I gave space in the command like:

$output=shell_exec("\Program Files (x86)\WordNet\2.1\bin\wn   ") 

it did not work.

Can you please help me what may be the reason for this and any suggestion for the solution?

Community
  • 1
  • 1
Bikash
  • 41
  • 8
  • 1
    The filename does not look valid to me for a windows path. Isn't the drive letter missing? – hakre Jun 15 '11 at 11:16
  • @hakre's comment looks like the answer -- try `C:\Program Files...` etc. – Spudley Jun 15 '11 at 12:45
  • 2)even when i added the drive letter it did not work. the code look like this:$output=shell_exec("C:\Program Files (x86)\WordNet\2.1\bin\wn home -synsn"); – Bikash Jun 15 '11 at 20:32

1 Answers1

1

ok i got the solution now.the problem was because of the spaces between the command.So i handled them as below:

$cmd = '"C:/Program Files (x86)/WordNet/2.1/bin/wn" "home" "-synsn"';
$output=shell_exec($cmd);

thanks to all who responded to my query

Brad
  • 159,648
  • 54
  • 349
  • 530
Bikash
  • 41
  • 8