CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Getting code from a section in a html page

 



Rivotti
User

Mar 24, 2000, 4:57 PM

Post #1 of 3 (794 views)
Getting code from a section in a html page Can't Post

I'm trying to create a program that grabs a piece of code in a html page and use it in the cgi program. I've tried to use HTML_TokeParser but it only let me use tags like <title> or <img>. What I want is to grab a section not a single tag.

Ex ( this is a piece of what I'm trying to do):

for ($j=0; $j<=$number; $j++)
{ print '<tr>
<td width="100%"><font size="1" face="Verdana">Habilitações '.$j.'<br>
<input type="text" name= "habilitacoes_'.$j.'" size="40"></font></td>
</tr>
<tr>
<td width="100%"><font size="1" face="Verdana"> </font></td>
</tr>'- } #(this is the section I want to grab.


Cure
User

Mar 24, 2000, 7:09 PM

Post #2 of 3 (794 views)
Re: Getting code from a section in a html page [In reply to] Can't Post

Hi

To fetch information from a website use the
LWP::Simple module.

go here to read the docoumentation on it and give example for it also.
http://www.cureable.com/modules/LWP/Simple.html


Cure

[This message has been edited by Cure (edited 03-24-2000).]


Rivotti
User

Mar 25, 2000, 4:13 AM

Post #3 of 3 (794 views)
Re: Getting code from a section in a html page [In reply to] Can't Post

Ok I used something like this:

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>

$url="http://www.contifax.com/cgi-bin/curriculum/html/passo3.htm";
$pagina=get($url);</pre><HR></BLOCKQUOTE>

Is it Right?

Now I want to grab what is inside the tag:
<! Temp == ($any characters) -->

Or inside the section:
[section]
($any characters
[/section]

Note: This can have html code such as:

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>


<img border="0" src="xxx.jpg"><br><h1>something</h1>
</pre><HR></BLOCKQUOTE>

The ideia is to open a file, grab a piece of the code inside the file and then used it inside a loop. Is something like what you do in the UBB Code:

you find the the [something]text[/something], grab the text inside and them apply the style [something] to the text.

Now apply this ideia to a file and use it in your CGI program.


[This message has been edited by Rivotti (edited 03-26-2000).]

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives