Welcome to Geeklog, Anonymous Sunday, December 22 2024 @ 01:00 am EST
Geeklog Forums
A Little PHP Help
Status: offline
sammykrupa
Forum User
Junior
Registered: 12/05/04
Posts: 28
I have noticed that everyone here seems to be very fluent in PHP. So here is my PHP problem (complete PHP noob here, watch out):
I would like to use this PHP script (for HTML to TEXT):
http://www.howtocreate.co.uk/php/dnld.php?file=0&action=1
The notes of the code say:
"To use this library, put the following line in your script before the part that needs it:
require('PATH_TO_THIS_FILE/html2text.php');"
I would be very happy if someone here could tell me how to enter the variable of the URL into this script. The way I would want to do it would be to have a webpage were you could enter a URL and have it converted.
Thanks!
Sam Krupa
I would like to use this PHP script (for HTML to TEXT):
http://www.howtocreate.co.uk/php/dnld.php?file=0&action=1
The notes of the code say:
"To use this library, put the following line in your script before the part that needs it:
require('PATH_TO_THIS_FILE/html2text.php');"
I would be very happy if someone here could tell me how to enter the variable of the URL into this script. The way I would want to do it would be to have a webpage were you could enter a URL and have it converted.
Thanks!
Sam Krupa
13
8
Quote
Status: offline
sammykrupa
Forum User
Junior
Registered: 12/05/04
Posts: 28
Okay, new problem.
This code:
<?php
// Include the class definition file.
require_once('class.html2text.inc');
// The "source" HTML you want to convert, stored in a file.
$filename =
// Instantiate a new instance of the class. Passing the filename
// followed by the "true" flag tells the class to find the HTML
// in the specified file. Should work on remote files, too.
$h2t =& new html2text($filename, true);
// The HTML is likely full of relative links, so let's specify
// an absolute source.
$h2t->set_base_url('home/');
// Simply call the get_text() method for the class to convert
// the HTML to the plain text. Store it into the variable.
$text = $h2t->get_text();
// Or, alternatively, you can print it out directly:
$h2t->print_text();
?>
I specify "filename" this way:
http://www.theplaceforitall.com/ipodinator/convert.php?filename=FILE.html
This only lets me specify local files. How do I specify URLs?
Sam Krupa
This code:
Text Formatted Code
<?php
// Include the class definition file.
require_once('class.html2text.inc');
// The "source" HTML you want to convert, stored in a file.
$filename =
// Instantiate a new instance of the class. Passing the filename
// followed by the "true" flag tells the class to find the HTML
// in the specified file. Should work on remote files, too.
$h2t =& new html2text($filename, true);
// The HTML is likely full of relative links, so let's specify
// an absolute source.
$h2t->set_base_url('home/');
// Simply call the get_text() method for the class to convert
// the HTML to the plain text. Store it into the variable.
$text = $h2t->get_text();
// Or, alternatively, you can print it out directly:
$h2t->print_text();
?>
I specify "filename" this way:
http://www.theplaceforitall.com/ipodinator/convert.php?filename=FILE.html
This only lets me specify local files. How do I specify URLs?
Sam Krupa
7
12
Quote
All times are EST. The time is now 01:00 am.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content