Hi, everybody.
I need to turn HTML into equivalent Markdown-structured text. From what I could discover, I have only two good choices:
Python: Aaron Swartz's html2text.py
Ruby: Singpolyma's html2markdown.rb
As I am programming in PHP, I need to pass the HTML code, call the Ruby/Python Script and receive the output back.
I started creating a simple test just to know if my server was configured to run both languages.
PHP code:
echo exec('./hi.rb');
Ruby code:
#!/usr/bin/ruby
puts "Hello World!"
It worked fine and I am ready to go to the next step.
Unfortunately, all I know is that the function is Ruby works like this:
HTML2Markdown.new('<h1>HTMLcode</h1>').to_s
I don't know how to make PHP pass the string (with the HTML code) to Ruby nor how to make the ruby script receive the variable and pass it back to PHP (after have parsed it into Markdown). Believe it or not: I know less of Python.
A folk made a similar question here ("how to call ruby script from php?") but with no practical information to my case.
Any help would be a joy - thanks.
Rogério Madureira.
atipico.com.br