1

So I am trying to parse content from an infoboxe template in a wikipedia page. But I have to use PHP because I cannot configure my server alone and I haven't the permission to do that. (So i cannot use the framework Dbpedia)

I need help because I am trying to understand how I can parse this object Infoboxe. Example on this url : http://fr.wikipedia.org/w/api.php?action=query&prop=revisions&rvprop=content&rvsection=0&titles=Roger_Federer

Plz Don't tell me to look the documentation, it's boring and not very usefull. I keep going trying to parse this content but I don't understand how I can do with PHP ?

THhhhhxxxx to help me !! :)))

Necko
  • 179
  • 2
  • 12

1 Answers1

1

You can call this python script using exec():

https://stackoverflow.com/a/9208881/956397

exec() manual: http://www.php.net/manual/en/function.exec.php

Community
  • 1
  • 1
PiTheNumber
  • 22,828
  • 17
  • 107
  • 180
  • I make like that : exec('infobox.py', $array_output_results); in the file infobox.py at the end I make get_info('Pablo_Picasso'); but the print doesn't display anything, where is the error ? – Necko Apr 18 '12 at 10:34
  • you have the infobox.py file in the same directory as your php script? Try using full path. Does it work, if you call it from command line? Also you want to collect the output: `exec('infobox.py', $output);` – PiTheNumber Apr 18 '12 at 10:40
  • Yes same directory, and I try to make "ls" thats works. Nope I think the server which host my web site probably doesn't have python installed, I don't see another way. I have any error catched or something like that – Necko Apr 18 '12 at 10:44
  • Did you make it executable? `chmod +x infobox.py`. Also try piping errors to stdout: `exec('infobox.py 2>&1', $output);` – PiTheNumber Apr 18 '12 at 10:49
  • Nothing changes. When i print_r the $output, it's empty. – Necko Apr 18 '12 at 10:55
  • hm... if you don't have a command line try http://sourceforge.net/projects/phpterm/ or check if python is installed `python -V` – PiTheNumber Apr 18 '12 at 11:15
  • No, it's sure i wanna use your script, it looks very nice ! I think I dont have on the server python installed; I dont see where the problem come from if its not because python is not installed – Necko Apr 18 '12 at 11:25