• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 202
  • Last Modified:

Extracting a Header and making it an Anchor?


How can I extarct the HEADER
Itried to use this similar technique
($header) =($html=~m#<H1>\s*(.*?)\s*</H1>#is);

But its not working ..what can I do?


the following code extracts the TITLE
($title) = ($html =~ m#<TITLE>\s*(.*?)\s*</TITLE>#is);



# htitle - get html title from URL

die "usage: $0 url ...\n" unless @ARGV;
require LWP;

foreach $url (@ARGV) {
    $ua = LWP::UserAgent->new();
    $res = $ua->request(HTTP::Request->new(GET => $url));
    print "$url: " if @ARGV > 1;
    if ($res->is_success) {
        print $res->title, "\n";
    } else {
        print $res->status_line, "\n";
    }
}
~
0
sdesar
Asked:
sdesar
  • 14
  • 14
1 Solution
 
ozoCommented:
use HTML::Parser;
0
 
sdesarAuthor Commented:
I tried it but it only extracts the li nk...how can I make it an anchor also?
0
 
guadalupeCommented:
I'm not sure why its not working for you.  It works great for me the.  The real question is what does the html code that your parsing look like.  More precisly can you be sure that the closing </h1> is used.  It is not necessary and therefore could be screwing up your regex.  Also this should not matter but try changing the delimiters to ! and not the comment chatacter like this:

($header) =($html=~m!<H1>\s*(.*?)\s*</H1>!is);

<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>
<BODY>
<h1>   Hello</h1>


If you like post the HTML fragment you are using to test and that may help.
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
sdesarAuthor Commented:
This is what I have

File1 -header
#!/usr/bin/perl
# header - get html HEADER <H1> from URL

($header) =($html=~m!<H1>\s*(.*?)\s*</H1>!is);
print $header;


File 2- header.html

<HTML>
<HEAD>
<TITLE> NEW DOCUMENT </TITLE>
</HEAD>
<BODY>
<h1> Hello there!! </h1>
<P> This is the first parah </P>
</BODY>
</HTML>

On the command line I typed--
$ perl header header.html

And there is no output.!!
What am I doing incorrectly?
0
 
guadalupeCommented:
Ok first is this all you script for file one because at no point does what you show here define $html as so there will never be a match.  You need to read the file in as passing it as a command line argument is not sufficient.  That merely makes the info passed (in your example the string "header.html") available by reading the @ARGV array. If you want to set the file to $html try this:

open(FILE, "$ARGV[0]");

      @File = <FILE>;
      $html = join(" ", @File);

close (FILE);

But remember that you have passed no path info so the script and file must be in the same dir.  Does this clarify it?
0
 
sdesarAuthor Commented:
Thanks.

Yes my files are all in the same directory.

This script now extracts the header <H1>

1- How can I have it extract multiple headers?
ex . <h1> <h2> etc.....
2- Also I want it to automatically create an anchor to that header
ex.

 <H1> Introduction </H1>--- This will be changed to <a name="Introduction">Introduction</A>
<P> this is the firs tparah </P>

<H2> Details </H2>
<P> this is the 2nd Parah </P>


Now I want to create anchors to these headers so the user can click and go to that section

ex.
 <A HREF="#Introduction">Introduction</A>

0
 
guadalupeCommented:
Change the regex in order to catch different headers like this:

(@headers) =($html=~m!<H\d>\s*(.*?)\s*</H\d>!is);

This will catch any h and a digit and place each instance in a seperate index of the array @headers.

then you could do this

foreach $header (@headers)
{
push(@links, "<a name=\"#$header\">");
print @link;
}

This will catch them but I seem to think that in the end instead of extracting them you may want to substitute. No ?
0
 
guadalupeCommented:
Sorry:

print @links; #Forgot the s
0
 
sdesarAuthor Commented:
This is what I have...
I am not getting any output after implementing this line
(@headers) =($html=~m!<H\d>\s*(.*?)\s*</H\d>!is);

also...
the foreach loop of substituting the header into a link is not working.


Thanks for helping....I sincerely appreciate your help.



#!/usr/bin/perl
# header - get html HEADER <H1> from URL


open(FILE, "$ARGV[0]");

                         @File = <FILE>;
                         $html = join(" ", @File);


($header) =($html=~m!<H1>\s*(.*?)\s*</H1>!is);

#(@headers) =($html=~m!<H\d>\s*(.*?)\s*</H\d>!is);

foreach $header (@headers)
                         {
                         push(@links, "<a name=\"#$header\">");
                         print @links;
                         }

#print $header;
#print $html;

close (FILE);
~
0
 
guadalupeCommented:
Ok sorry the match for the headers lacks the g switch wich means global or perform the match as many time as possible and don't just stop at the first.  That would be like this.

(@headers) = ($html=~m!<H\d>\s*(.*?)\s*</H\d>!isg);
 
The the loop should work as it works for me but move the print outside or you keep printing the Array each pass with one more element.  Like this

foreach $header (@headers)
                         {
                         push(@links, "<a name=\"#$header\">");
                         
                         }
print @links;
0
 
sdesarAuthor Commented:
Thanks for your help...

1.       I implemented the suggestions... however, these headers are extracted but is all in one line.  
2.      And they are stored in a different file.  I want them to be in the same HTML but on the top of the document.   Is it possible to do this without ovewriting the Document.

3.  The For each loop I changed it so it says HREF instead.... because this is what should happen
Once <H4> is seen..... its extracted

<H4>Teaching<H4>

And changed to ----

<a href="#Teaching">Teaching</A>  
at the Top of the document.

Also, The header within the document
needs to be Modified so it has an Anchor to it.

<H4>Teaching<H4>
<P> This is adding an anchor aroung the header </P>

changed to ---
<A name="Teaching"><H4>Teaching<H4></A>


Could you please help?
0
 
guadalupeCommented:
Yes I can but let's cvlarfy what you want.  First edit the document so that the headers become anchors ex:

<A name="Teaching"><H4>Teaching<H4></A>

Next that the headers be extrated converted into links and the placed "at the top"  this is a rather loose especification.  You can place them directly after the <body> tag does that sound good?

0
 
sdesarAuthor Commented:
THANKS for your time and help... I really appreciate it.

I hope the following explanation helps......

Oh yes... Placing them after the Body Tag is good too....sounds good

 Also I am assuming that in a Large document the headers are just Headers and they do not have an Anchor to link to.


I changed this line to href--- because it has to be an anchor so the user can cilck & go to that Header.

  push(@links, "<a href=\"#$header\"> $header</a>");  

Here are my files----

#!/usr/bin/perl
# header - get html HEADER <H1> from URL


open(FILE, "$ARGV[0]");

                         @File = <FILE>;
                         $html = join(" ", @File);


#($header) =($html=~m!<H1>\s*(.*?)\s*</H1>!is);

(@headers) =($html=~m!<H\d>\s*(.*?)\s*</H\d>!isg);

foreach $header (@headers)
                         {
                    #     push(@links, "<a name=\"#$header\"> $header</a>");
                          push(@links, "<a href=\"#$header\"> $header</a>");                    
                         }

print @links;

close (FILE);

-------
HTML File
<HTML>
<HEAD>
<TITLE> NEW DOCUMENT </TITLE>
</HEAD>


<a href="#Teaching">Teaching</A>(yellow and white)



<BODY>


<P>THIS IS THE BEGIN

Adopting 00 technology means that we must rethink how we view software systems. For the past two decades, software has been
engineered using procedural programming languages which support the top-down programming (structured) paradigm. This
paradigm is based on the notion that software is developed as a collection of procedures where each procedure is created to solve a
particular task. These procedures, like recipes in the culinary arts, are designed to address specific problems with step-by-step
enstructions which lead toward a solution. The structured approach is intuitive and natural to the typical computer science student
who has been taught from early grammar school years to "read and follow directions". On the other hand, the 00 paradigm views the
This
paradigm is based on the notion that software is developed as a collection of procedures where each procedure is created to solve a
particular task. These procedures, like recipes in the culinary arts, are designed to address specific problems with step-by-step
enstructions which lead toward a solution. The structured approach is intuitive and natural to the typical computer science student
who has been taught from early grammar school years to "read and follow directions". On the other hand, the 00 paradigm views the

paradigm is based on the notion that software is developed as a collection of procedures where each procedure is created to solve a
particular task. These procedures, like recipes in the culinary arts, are designed to address specific problems with step-by-step
instructions which lead toward a solution. The structured approach is intuitive and natural to the typical computer science student
who has been taught from early grammar school years to "read and follow directions". On the other hand, the 00 paradigm views the



</P>



<A name="Teaching"><H4>Teaching<H4></A>
(Whites, yellows, and greens).

<P>

Object-Oriented (00) technology is seen as the most important software engineering advancement of the past decade. With its
properties of objects, classes, and inheritance, software development becomes a process of building blocks instead of writing
programs from scratch. The properties of this new paradigm have led to software that is reusable, highly maintainable, and provides
simplicity to even extremely complex systems.



</BODY>
</HTML>

0
 
guadalupeCommented:
OK I think we finally have it:

#!/usr/bin/perl
# header - get html HEADER <H1> from URL


open(FILE, "$ARGV[0]");

@File = <FILE>;
$html = join(" ", @File);

close (FILE);

#Convert all headers into named anchors
$html =~ s!(<H\d>\s*)(.*?)(\s*</H\d>)!$1<a name="#$2">$2</a>$3!isg;


#Match Headers
(@headers) =($html=~m!<H\d>\s*(.*?)\s*</H\d>!isg);

#Construct links to headers
foreach $header (@headers)
{
      $links .= qq(\n<a href="#$header">$header</a><br>\n);
 
}

#Place links at top of page after <Body> tag
$html =~ s/(<body[^>]*>)/$1$links/i;

#Write out new document
open(FILE, ">$ARGV[0]");

print FILE $html;

close(FILE);
0
 
sdesarAuthor Commented:
Thanks....for your help.

I did the following on the command line inorder to run the script... however I am not getting any output....

$perl header header.html > headerOut.html

The headerOut.html contains no data... any suggestions .... the input file - header.html is not being passed .
0
 
sdesarAuthor Commented:
Could you please help me ... ?
0
 
guadalupeCommented:
First maybe I understood but the script edits the document.  It does not write anything to a second doc.

Second, it seems like your call should be more like this:

$perl header.pl header.html
0
 
sdesarAuthor Commented:
Yes... you are right ...
Ok ... it works but a minor problem..

Heres the Output I am getting in the header.html file

<a href="#<a name="#<a name="#Intorduction">Intorduction</a>"><a name="#Intorduction">Intorduction</a></a>"><a name="#<a name="#Intorduction">Intorduction</a>"><a name="#Intorduction">Intorduction</a></a></a><br>

<a href="#<a name="#Teaching">Teaching</a>"><a name="#Teaching">Teaching</a></a><br>


There seems to be an extra > after the first </a>

Help Pretty Please!!
0
 
guadalupeCommented:
#!/usr/bin/perl
# header - get html HEADER <H1> from URL


open(FILE, "$ARGV[0]");

@File = <FILE>;
$html = join(" ", @File);

close (FILE);

#Match Headers
(@headers) =($html=~m!<H\d>\s*(.*?)\s*</H\d>!isg);


#Convert all headers into named anchors
$html =~ s!(<H\d>\s*)(.*?)(\s*</H\d>)!$1<a name="#$2">$2</a>$3!isg;

#Construct links to headers
foreach $header (@headers)
{
      $links .= qq(\n<a href="#$header">$header</a><br>\n);
 
}

#Place links at top of page after <Body> tag
$html =~ s/(<body[^>]*>)/$1$links/i;
print $html;

#Write out new document
open(FILE, ">$ARGV[0]");

print FILE $html;

close(FILE);
0
 
guadalupeCommented:
I must have pasted the old version last time... sorry.
0
 
sdesarAuthor Commented:
I gave you excellent points ....
I deleted # from name=#..... inorder for it to work.

Thanks for your help!!  Thanks a Million
I really appreciate it.

How can I write this into the CGI script?
This script fetches the URL and saves it in
HTML and ASCII.

I want the above script to incuded within this script to it grab all the headers and makes them anchors
and then saves it in the modified  fileheaders.html

#!/usr/bin/perl
#url_fetch.cgi


use LWP::Simple;
use HTML::Parser;
use CGI;

my $cgi = new CGI;
my $url = $cgi->param('url');

my $HTTP_ROOT = "/web/public/grad/sdesar/file.txt";
my $HTTP_ROOT1 = "/web/public/grad/sdesar/file.html";


if ( $url ne "" )
{
$content = fetch( $url );
if ( $content ne "" )
{
print $cgi->header( -type => 'text/plain' );
my $plain_text = plain_text($content);
print $plain_text;
print $content;
my $plain_text = plain_text( $content );

print $plain_text, "\n";

cp_to_file( $plain_text, "$HTTP_ROOT" );
print $cgi->redirect( "/file.txt" );
##########copy the HTML

print $cgi->header( -type => 'text/plain' );
my $cp_to_file_html = cp_to_file_html($content);
print $cp_to_file_html;
print $content;
my $cp_to_file_html = cp_to_file_html( $content );

print $cp_to_file_html, "\n";

cp_to_file_html( $cp_to_file_html, "$HTTP_ROOT1" );
print $cgi->redirect( "/file.html" );



}
else
{
output_form( "Could not load URL: $url<br>" );
}
}
else
{
output_form( "Enter URL to fetch" );
}
sub output_form
{
my $msg = shift;

# output the html header
print $cgi->header( -type => 'text/html' );

# print the message if there is one
print "$msg<br>\n";

# output the form for the user
print $cgi->start_html;
print $cgi->start_form;
print "Please enter another URL:  ";
print $cgi->textfield( -name=>'url', -value=>'http://www.' );
#print $cgi->textfield('url');
print $cgi->br;
print $cgi->submit( -label => 'Fetch' );
print $cgi->end_form;
print $cgi->end_html;
}#print "Content-type: text/plain \n\n";
#print "TEST";




#### subroutines
sub fetch {
my ($url) = @_;
my $cont;

$cont = get($url);
return $cont;
}

# copies text to file

sub cp_to_file {
my ($text, $to_file) = @_;

open(OUT, ">" . $to_file);
print OUT $text;
close(OUT);
}

# copies file at HTML to a file

sub cp_to_file_html {
my ($text, $to_file) = @_;

open(OUT, ">" . $to_file);
print OUT $text;
close(OUT);
}

# converts html text into plain text; (simplistic approach)

sub plain_text {
my ($in_text) = @_;
my $plain;

($plain = $in_text) =~ s/<[^>]*>//gs;

return $plain;
}

0
 
guadalupeCommented:
Ok now I'm just confused.  I think we need to insert this into the sub cp_to_file_html but first I am very confused by some of your code.  For example why the repetition of these lines here:

print $cgi->header( -type => 'text/plain' );
my $plain_text = plain_text($content);
print $plain_text;
print $content;
my $plain_text = plain_text( $content );

print $plain_text, "\n";

Then why do you call the sub cp_to_file_html with only one parameter when it expects two.  All of this confuses me and makes me doubt what your doing and therefore makes me doubt exactly what you want...

All that said my best guess is that the sub cp_to_file_html is what writes the HTML file and you want these edits made just before the writing occurs.  If this is the case the sub should look like this:

sub cp_to_file_html
{
      my ($text, $to_file) = @_;

      #Match Headers
      (@headers) =($text =~ m!<H\d>\s*(.*?)\s*</H\d>!isg);


      #Convert all headers into named anchors
      $text =~ s!(<H\d>\s*)(.*?)(\s*</H\d>)!$1<a name="#$2">$2</a>$3!isg;

      #Construct links to headers
      foreach $header (@headers)
      {
            $links .= qq(\n<a href="#$header">$header</a><br>\n);
      
      }

      #Place links at top of page after <Body> tag
      $text =~ s/(<body[^>]*>)/$1$links/i;


      open(OUT, ">" . $to_file);
      print OUT $text;
      close(OUT);
}

Just be carful to pass it both params.  If I didn't get it let me know...

0
 
sdesarAuthor Commented:
I did as you suggested... however,
fileHeader.html cointains no data....  
The permissions on this file is 777

The other files--- file.txt and file.html are being updated correctly.

I made another subroutine called cp_file_html_header...

It seems like either is subroutine is not writting to the fileHeader.html

----- Could you please check it out ? and Provide your suggestions?

Heres the entire script....

#!/usr/bin/perl

# File : url_fetch_header.cgi

use LWP::Simple;
use HTML::Parser;
use CGI;

my $cgi = new CGI;
my $url = $cgi->param('url');

my $HTTP_ROOT = "/web/public/grad/sdesar/file.txt";
my $HTTP_ROOT1 = "/web/public/grad/sdesar/file.html";
my $HTTP_ROOT2 = "/web/public/grad/sdesar/fileHeader.html";

if ( $url ne "" )
{
$content = fetch( $url );
if ( $content ne "" )
{
print $cgi->header( -type => 'text/plain' );
my $plain_text = plain_text($content);
print $plain_text;
print $content;
my $plain_text = plain_text( $content );

print $plain_text, "\n";

cp_to_file( $plain_text, "$HTTP_ROOT" );
print $cgi->redirect( "/file.txt" );

##########copy the HTML

print $cgi->header( -type => 'text/plain' );
my $cp_to_file_html = cp_to_file_html($content);
print $cp_to_file_html;
print $content;
my $cp_to_file_html = cp_to_file_html( $content );

print $cp_to_file_html, "\n";

cp_to_file_html( $cp_to_file_html, "$HTTP_ROOT1" );
print $cgi->redirect( "/file.html" );

##########copy HTML and Summarize headers after the BODY

print $cgi->header( -type => 'text/plain' );
my $cp_to_file_html_header = cp_to_file_html_header($content);
print $cp_to_file_html_header;
print $content;
my $cp_to_file_html_header = cp_to_file_html_header( $content );

print $cp_to_file_html_header, "\n";

cp_to_file_html_header( $cp_to_file_html_header, "$HTTP_ROOT2" );
print $cgi->redirect( "/fileHeader.html" );


}
else
{
output_form( "Could not load URL: $url<br>" );
}
}
else
{
output_form( "Enter URL to fetch" );
}

sub output_form
{
my $msg = shift;

# output the html header
print $cgi->header( -type => 'text/html' );

# print the message if there is one
print "$msg<br>\n";

# output the form for the user
print $cgi->start_html;
print $cgi->start_form;
print "Please enter another URL:  ";
print $cgi->textfield( -name=>'url', -value=>'http://www.' );
#print $cgi->textfield('url');
print $cgi->br;
print $cgi->submit( -label => 'Fetch' );
print $cgi->end_form;
print $cgi->end_html;
}
#print "Content-type: text/plain \n\n";
#print "TEST";




#### subroutines
sub fetch {
my ($url) = @_;
my $cont;

$cont = get($url);
return $cont;
}

# copies text to file

sub cp_to_file {
my ($text, $to_file) = @_;

open(OUT, ">" . $to_file);
print OUT $text;
close(OUT);
}

# copies file at HTML to a file

sub cp_to_file_html {
my ($text, $to_file) = @_;

open(OUT, ">" . $to_file);
print OUT $text;
return $text;
close(OUT);
}# copies the summarized headers to a fileheader.html

sub cp_to_file_html_header {
                      my ($text, $to_file) = @_;

                      #Match Headers
                      (@headers) =($text =~ m!<H\d>\s*(.*?)\s*</H\d>!isg);


                      #Convert all headers into named anchors
                      $text =~ s!(<H\d>\s*)(.*?)(\s*</H\d>)!$1<a name="$2">$2</a>$3!isg;

                      #Construct links to headers
                      foreach $header (@headers)
                      {
                      $links .= qq(\n<a href="#$header">$header</a><br>\n);

                      }

                      #Place links at top of page after <Body> tag
                      $text =~ s/(<body[^>]*>)/$1$links/i;


                      open(OUT, ">" . $to_file);
                      print OUT $text;
                      close(OUT);
}



# converts html text into plain text; (simplistic approach)
sub plain_text {
my ($in_text) = @_;
my $plain;

($plain = $in_text) =~ s/<[^>]*>//gs;

return $plain;
}





0
 
guadalupeCommented:
Ok, not to be critical but you code is still ver hard to understand, due to the multiple repititions of the same lines and calls to subs with fewer arguments than it expects with the sole aim (it would seem) of letting it return the same value you send to it in order to reassign it to a ne variable.  Its very confusing, howevere all that having been said I have one idea... in this section of code:

##########copy HTML and Summarize headers after the BODY

print $cgi->header( -type => 'text/plain' );
my $cp_to_file_html_header = cp_to_file_html_header($content);
print $cp_to_file_html_header;
print $content;
my $cp_to_file_html_header = cp_to_file_html_header( $content );

print $cp_to_file_html_header, "\n";

cp_to_file_html_header( $cp_to_file_html_header, "$HTTP_ROOT2" );
print $cgi->redirect( "/fileHeader.html" );

you send the new variable $cp_to_file_html_header the the sub of the same name.  Are you sure it has a value.  Try sending it $content like all the others.  If I understood all the backs and forths they should be the same value.

0
 
sdesarAuthor Commented:
I tried it but its not working...

I think the problem is with the following subroutine..

sub cp_to_file_html_header {
                                      my ($text, $to_file) = @_;

                                      #Match Headers
                                      (@headers) =($text =~ m!<H\d>\s*(.*?)\s*</H\d>!isg);


                                      #Convert all headers into named anchors
                                      $text =~ s!(<H\d>\s*)(.*?)(\s*</H\d>)!$1<a name="$2">$2</a>$3!isg;

                                      #Construct links to headers
                                      foreach $header (@headers)
                                      {
                                      $links .= qq(\n<a href="#$header">$header</a><br>\n);

                                      }

                                      #Place links at top of page after <Body> tag
                                      $text =~ s/(<body[^>]*>)/$1$links/i;


                                      open(OUT, ">" . $to_file);
                                      print OUT $text;
                                      close(OUT);
                }


This routine does not have a Variable defined for getting the file.html ... that's where the Headers are...

So I tried to define it so it accepts that file--- file.html
...... and then do its getting headers...
.......Finally store it in fileHeaders.html

But I guess I don't have the syntax right..

Because all I get as OUTPUT in fileheader.html is --- file.html

Heres the subroutine....
# copies the summarized headers to a fileheader.html

sub cp_to_file_html_header {
                      my ($text, $to_file) = @_;
                     open(FILE, "file.html");
                      $text = join(" ", "file.html");
                      close ("file.html");

                 #original###     open(FILE, "$ARGV[0]");

                   #   @File = <FILE>;
                   #  $text = join(" ", @File);

                   #   close (FILE);


                #Match Headers
                      (@headers) =($text =~ m!<H\d>\s*(.*?)\s*</H\d>!isg);


                      #Convert all headers into named anchors
                      $text =~ s!(<H\d>\s*)(.*?)(\s*</H\d>)!$1<a name="$2">$2</a>$3!isg;

                      #Construct links to headers
                      foreach $header (@headers)
                      {
                      $links .= qq(\n<a href="#$header">$header</a><br>\n);

                      }

                      #Place links at top of page after <Body> tag
                      $text =~ s/(<body[^>]*>)/$1$links/i;
                      print $text;

                    #  return $text;
                      open(OUT, ">" . "$HTTP_ROOT2");
                      print OUT $text;
                      return $text;
                      close(OUT);
}


Help Pretty Please!!!
0
 
sdesarAuthor Commented:
Clarification...
I don't need to use the cp_to_file subroutine.

But I need to open the file.html and thats the one that needs to be modified.

How do I call the sub cp_to_file_html_header, so that its ouput goes to fileHeader.html
0
 
guadalupeCommented:
Ok I'm really sorry to say this but you keep making it more and more confusing.  Your subroutine is set up to accept two parameters: the text to be written to a file and the name of the file it should be written to.  If you want to call cp_to_file_html_header so that the info goes to fileHeader.html call it like this:

&cp_to_file_html_header($text,"fileHeader.html");

One confusing this thought is that you send the text to the sub but then open a file and put that in the variable $text ddestroying what you had sent to the sub in the first place?!?  Lets start from the top and see if we cant claify and if I can get a better feel for what the heck is happening I'll help you re-write the whole thing because to be honest its a mess (sorry to be harsh but...).

The first question is:

Once this section of code executes:

if ( $url ne "" )
{
$content = fetch( $url );
if ( $content ne "" )
{

What does $content have?  Is it the document on which we must perform the code for the original question (that is, find headers, convert to neamed anchors and create corresponding links at top of page) ?

0
 
sdesarAuthor Commented:
This is my first attempt at writting a CGI script.  
I apologise for making it confusing for you.

Thanks for the suggestions...
Since you are so confused... so was I ...
BING...
I realized that I was creating a
Subrountine-- cp_to_file ... 2 or 3 times
and the whole reason for a Subrountine is so that
I don't need to copy -paste again and again...
Well,
I cleared up extra calls and the $content variable..
I renamed it for the Headers subroutine.... because if was getting confused with the cp_to_file_html function.

Thanks... It all works now.

Thanks a million for your help and time, its all
sincerely apprecited!!

0
 
guadalupeCommented:
No problem,  glad we could get it all sorted out!
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 14
  • 14
Tackle projects and never again get stuck behind a technical roadblock.
Join Now