Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP






SuperbHosting.net & Arvixe.com have generously sponsored dedicated servers and web hosting to ensure a reliable and scalable dedicated hosting solution for BigResource.com.







How To Get A Title Out A Html File


I'm trying to create a search engine, but now I need to get the title from the file as output.


View Complete Forum Thread with Replies
Sponsored Links:

Related Messages:
How To Extract A Page Title From An HTML File
I am trying to extract the page title, description and keywords from an HTML page. Description and Keywords are easy, using get_meta_tags().

View Replies !   View Related
Add Html Title
How do you add a (html title) to this image?

$Cat .= "<tr>
<td style="padding:0px">
<caption align=center style="padding:0px">
<img src="myimages/pic1.gif" border="0" >
</caption>
</td>
</tr>";

View Replies !   View Related
Pulling Title Tag Out Of HTML
Is there a simple piece of php code(s) that can pull the title of a
web page out? We need to pull the words in between <title></titleand
insert it into stumble upon. Here is what their requirements are:

View Replies !   View Related
Reading HTML Title In PHP
I am challenged with the task of writing a PHP script that will prompt the user for a website (ex: yahoo.com). When submitted, the PHP script will somehow open the web page as a file, somehow search the source, find the <title> tag, and return the title of the web page..

If someone knows an easier approach to this, I would appreciate it. Opening an entire website as a variable seems like a bit of overkill..

Heres where I'm at so far, I'm kind of looking for a push in the right direction. I've been googling for awhile now trying to find out how to tackle this, but searching for things like "php, website, title, web page, HTML" hasn't proved too successful..

<?php

// Assigns $site from the form text box named "site"
//
$site = $_POST['site'];

$file = fopen($site, "r");

// This needs to open the text-source of the inputted webpage.  
// From here I will search for the <title> tag in the HTML...
//
echo "$file";
echo "<br><hr>";

?>

View Replies !   View Related
Getting Title From HTML Links
I'm trying to get the title from a string with an html link using this code:

<?php
$string = "<a href=/test>test link</a>";
$get_title = ereg_replace('<a href=[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]+>([[:alpha:]])+</a>', &#391;', $string);
echo $string;
?>

however, it just spits out the same HTML link, a bit of help please?

View Replies !   View Related
$title Not Displaying In <title>$title</title>
For some reason $title will not display in the <title></title> using print or echo. I've tried modifying the if staments to ifelse, and even fiddled with $_GET to get this working. Tried dbl/single quotes, even changed the variable around thinking $title might be a global. nothing working yet. Any ideas?

<?php
$page == 'home'
$title == "Welcome!";
if ($page == 'home') { $title == "Welcome!"; }
elseif ($page == 'about') { $title == "about us"; }
elseif ($page == 'products') { $title == "Products"; }
elseif ($page == 'services') { $title == "Services"; }
elseif ($page == 'repair') { $title == "Upgrades & Repairs"; }
elseif ($page == 'network') { $title == "Network Solutions"; }
?>
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>My Site - <?php print "$title";?></title>
</head>
<body bgcolor="#FFE0C1">
...

View Replies !   View Related
Title Tags In A File
I am reading in HTML, and I am trying to use preg_match to find the title tags, and print out what is between the two tags. Current code (Doesn't work):

preg_match("~<title>W|w</title>~",$contents,$match)

View Replies !   View Related
Can Include File Read Its Parents <title> And URL ?
I have a php file in which I am including(not really with include statement but <img src=""> ) an other file which does some processing work before outputting a GD generated image. PHP Code:

View Replies !   View Related
File Properties - (Title, Subject, Author)
I have to list on a web page the contents of a folder and for each file i have to show the file properties (Title, Subject, Author). when you right click on a file in your harddrive, go to properties and the information i want is in the Summary tab.

View Replies !   View Related
Obtaining File Attribute - Title, PDF, Word, Excel
I'm trying to write something that will traverse the directory
structure of my web server directory and pull some particular
information on particular file types to create a listing of what all is
where.

For PDF files I want to find the title. I've been looking through
php.net and the ClibPDF Functions, but I'm still not clear on how to
find the title of an existing pdf document. Code:

View Replies !   View Related
Display Article's Title In Title Tag
I want to show the article's title in the title tag. But I can't display the title from the article because the title tag is loaded first and the the rest of my page.

I have a solution with javascript but if you haven't enable javascript, you'll see nothing so I want to do this with PHP, but how. Code:

View Replies !   View Related
I Need Information From To ......
I have to retrive the title tag information? can you tell me. i
am new to the php ........

can you give the example to get the information between <title> to </title> from the web page...... how shall i get it.

View Replies !   View Related
Convert ##TITLE## To $title
Im half way through making an article manager for a new site im launching. If i type ##TITLE## into a text box, when i display the artcile, how do i turn the placeholder ##TITLE## into $title of the article.

i looked at str_replace but i dont think thats what i need... i need something that searched through the text of a var and if it finds anything within ##*## to convert the * into the $var.

View Replies !   View Related
Include An Html File In Another Html File?
Can I include an html file in another html file usign PHP? Something like the way you would inlclude a text file, only have the html elements show up?

View Replies !   View Related
File Upload NOT Using HTML Input Type=file
in an earlier post on the javascript forum i was talking about a small program i'm writing to allow file uploads through the http protocol that look and function similar to a ftp client.

I have made some nice progress on this project and am able to return the FSO collection from the client pc. this allows me to list of directories on the page so users can select multiple files to upload at once or even entire directories. Code:

View Replies !   View Related
Require_once(&lt;html Fragment File&gt;) Vs Document.write(&lt;html Fragment&gt;)
To reuse common fragments of html on many pages I have used javascript functions, called from a linked .js file, which are precisely one instruction: document.write(<the html>).
I'm starting to learn PHP now and see that a require_once(<url for file containing the html fragment>); will have the same affect.

My question is, which method is more efficient? i.e. renders faster?

P.S. is there a simple way to set up testing-only server-software on my local machine so i can debug php locally before uploading them to site's server?

View Replies !   View Related
Access Button In HTML File Through PHP File
I’m new to PHP and I’m working on a code and having a problem .
The problem is that I’m having an HTML file like this :

////////////////////////////////////

<p>some text</p> <form action="/project/myfile.php" method="post"> <input type="button" name="mybutton.1" value=" mybutton "><input type="text" name="aaa" /> </form>

<p> some text </p> <form action="/project/myfile.php" method="post"> <input type="button" name=" mybutton.2" value=" mybutton "><input type="text" name="aaa" /> </form>

//////////////////////////////////////

I want to open a new HTML file to the user when he clicks on any of these buttons . I want to do this in the file named “myfile.php “ . What should I write in the file “myfile.php “ to get access to each button and open a new page when the user clicks on it? Is it correct to put " action="/project/myfile.php""? Should I put include the HTML file in my PHP file? I want also to remember which button the user clicks on.

View Replies !   View Related
How To Include A Php File In HTML Without Calling The File .php
I'm wondering how I can include a php file in my html code, without calling the file .php, but keeping it as a .html file?

View Replies !   View Related
Variables Not Passing From Html File To Php File
I have the following two files used to insert data into a database. when
meinsert.php is executed a blank record is inserted in the database as if
the .php file is not receiving the variables.

Any ideas why this might be happening? Environment is stock RH9 with no
updates. I believe it is PHP 4.2.2 and Apache 2.0.40.

meinsert.html
<html>
<body>
<form action="meinsert.php" method="post">
Last Name: <input type="text" name="lastname"><br>
His Name: <input type="text" name="hisname"><br>
Her Name: <input type="text" name="hername"><br>
Address: <input type="text" name="address"><br>
City: <input type="text" name="city"><br>
State: <input type="text" name="state"><br>
Zip: <input type="text" name="zip"><br>
Phone Number: <input type="text" name="phone"><br>
Email: <input type="text" name="email"><br>
Weekend Date: <input type="date" name="WkEndDate"><br>
Wedding Date: <input type="text" name="weddate"><br>
Referred By: <input type="text" name="referred"><br>
Prayer Couple: <input type="text" name="prayercouple"><br>
Paid: <input type="text" name="paid"><br>
Area: <input type="text" name="area"><br>
<input type="submit" value="SUBMIT"><br>
</form>
</body>
</html>

meinsert.php
<html>
<head>
<title>Insert Couple to Database</title>
</head>
<body>

<?php

//connect to database server
$dbcnx = @mysql_connect("localhost", "root", "password");.....

View Replies !   View Related
Can I Run PHP File Inside A HTML File?
I want a count file(PHP) to be executed when a HTML file requested. How can I do this? I have no idea about excuted a PHP file inside a HTML file.

View Replies !   View Related
Get Title?
How do you get the title of a(n) external webpage? Ive seen it done on the vBulletin's software. Anyone know how to exactly do this? Or is there a PHP function already added to the PHP software that I don't know about.

View Replies !   View Related
<title>
im trying to put the title of the page to my file and i keep getting headers sent messages ... i tried ob_start(); and it still wont work how would i go about putting
<title>my title ... </title> to my file below? Code:

View Replies !   View Related
Title
Why doesn't the contents of the "title" field get displayed on the screen?

<?php
$con = mysql_connect("localhost","ODBC","");
if (!$con)
{
  die(mysql_error());
}

mysql_select_db("MP3", $con);

$result = mysql_query("SELECT * FROM books");

  echo $result['title'];

mysql_close($con);
?>

View Replies !   View Related
Title,URL
I have the following example that will extract the TITLE from a web page successfully but how can I extract the TITLE from a "redirected" link.
<?php
$file = fopen ("http://www.example.com/", "r");
if (!$file) {
echo "<p>Unable to open remote file.
";
exit;
}
while (!feof ($file)) {
$line = fgets ($file, 1024);
/* This only works if the title and its tags are on one line */
if (eregi ("<title>(.*)</title>", $line, $out)) {
$title = $out[1];
echo "$title";
break;
}
}fclose($file);
?>

View Replies !   View Related
How Can I Show A Title?
The script below is from a popup window that I have that displays projects, what I would like, is that the title of the window have the project title in it, Code:

View Replies !   View Related
Dates In Title?>
Would it go something like this

<title>Title <?php date('Y') ;?> </title>

to get the year in the title or isnt it possible?

View Replies !   View Related
Page Title
I have another post on here for this problem but I think I have overcomplicated the matter.. Ok in it's simplest form: Is there a way to retrieve the current page title and place it into a PHP variable?

something like"

$pagetitle = **** Title of the current page I'm viewing ****

View Replies !   View Related
Title Case
I haven't found a way to set title case in PHP... IE:

test tItle => Test Title

Is there a way to achieve this?

View Replies !   View Related
Match Title
I am trying to get a the title out of a html page, I have the html code loaded into a variable. The only thing is sometimes the title is not on the same line.

<title>need this text</title>

$title = preg_match(/<title>s</title>/i, $html);

help me with this match syntax?

View Replies !   View Related
Title Of Page
On an arbitrary web page, I would like the code to return the web path to that page and including the title of that page. The purpose is to provide folks who might want to link to the page the actual code they need to make the link by cutting and pasting the code into their own site. Something like this: Code:

<a href="http://www.phpbuilder.com/example.php">Page Title</a>

View Replies !   View Related
Title Tag In Mozilla
$varible is "3 lines text........................... ...................... ........................";
I have used echo "<img src="../images.gif" tilte="$variable"></img>";

But on tooltip all the 3 lines is shown in a single line with mozilla browser. In IE it is shown in separate lines. How to avoid the problem of displaying the tooltip in a single line with mozilla firefox.

View Replies !   View Related
Change The Title
I'm trying to change the title on just my home page. Can anyone help me where I should insert it and how I should insert it in this code.

<title><?php if ( get_bloginfo('version') < &#392;' ) : echo wp_title('',false); if (!is_home() ) : echo ' - ' endif;
elseif ( is_search() ) : echo wp_specialchars($s).' - '
elseif ( is_category() ) : single_cat_title(''); echo ' - '
elseif ( is_year() ) : echo get_the_time('F').' - '
elseif ( is_month() ) : echo get_the_time('F Y').' - '
elseif ( is_day() ) : echo get_the_time('F jS, Y').' - '
elseif ( is_404() ) : echo "Not found - ";
elseif (!is_home() ) : if ( get_the_title() ){ the_title(); }else{ echo "Untitled"; }; echo " - ";
endif // is_search()?>
<?php bloginfo('name')?></title>

View Replies !   View Related
Accessing The Next Title
I access the current page title as $row['title']; which is within a while loop. Now how do i access the title of the next row in database? something like $row['title'+1]; gives me an output as 1 .

View Replies !   View Related
Dynamic Title With From Db
I use a header.php page and a content.php page. The header.php is of course just the header, the content.php is database driven. I want the article title on the content.php page to display in the Title bar. Code:

View Replies !   View Related
Preg_match For Title
I have a simple function that extracts the contents of <title> tag from the files in a given folder.

function getTitle($filePath)
{
$content = file_get_contents($filePath);
if(preg_match('#<title>(.+?)</title>#msi', $content, $matches))
{
return $matches[1];
}
return 'Untitled'
}

However, some pages contain the title as <title><? echo $thisPage; ?></title> and the function returns echo $thisPage; without interpretation.

Could anyone help find out how to make this readable by preg_match?

View Replies !   View Related
Echo TITLE
Is it possible to echo the title of a page:

<htad>
<title>Page 1</title>
</head>
........

View Replies !   View Related
In Page Title
I'm trying to put some php in a web page title (after the text part of the title), so that it will number each page differently in the title. Whats the best way to do it? Is there some sort of taboo against putting too much code in the <title></title> of the page?

Or is it anything goes as long as it isn't too rediculous. Heres the part of the code that determines what page number it is. In the browsers output all I am getting is all this code in the title though, instead of just 1, 2, etc. or whatever page it is on. Whats the proper way to put Code:

View Replies !   View Related
Title Of My Page
Im very new to php. Is it poosible to do something to include the tilte of my page in the body of my page.

View Replies !   View Related
Getting The Page Title
I'm trying to do is find a way of getting the page title (the bit between <title> and </title>) from a string that represents that contents of a webpage. I've spent an hour and 41 minutes researching this one on Google and can't find a solution.

View Replies !   View Related
How To Take The 5th </div> In A Html File ?
How to take the 5th </div> in a html file ?

View Replies !   View Related
HTML File In PHP
I need to create a php script that will input some HTML code into a .html file. The script will then place a link to this file. Is this possible? How can I go about doing it? Also, would problem arise with the permissions of the file created.

View Replies !   View Related
Html File
I have a php script that is called by different html pages. The html pages will contain forms and when the submit button is called the php script is called (Even though the forms are different, I use an array for all the elements and it works fine).

View Replies !   View Related
How To Get Page Title, In Not An Easy Way
ok, here is the situation

i have included header.php into index file but
i have this in index.php:
[php]
switch($_GET['action']) {
case 'page':
$pages[0] = "news0.php";
$pages[1] = "news1.php";
.
.

if ($_GET['page'] != "") {
$to_include = $_GET['page'];
include ($pages[$to_include]);
}
break;
default:
include("news.php");
[php]


i tried all sort off stuff like implode, pregmatch,ordinary passing $title variable, $_PHPSELF, and nothing seems to be working.

all i want to do is to get title like domain.com-news.

can anybody give me a tip what should i do?

View Replies !   View Related
Title Replace Problem
Here is some of my upload code i am using but i am having problems trying to insert the title into the database, the first is with spaces allowed and the second is without spaces and filled with _ instead, but it wont do it.

I have this a value called $title and this is the title a user gives their submission, and i want to rename the file the same as the title but with the spaces replaced with _ u following me?

I have done it do it does this but when it inserts the title into the database, the spaces are replaces with the _ instead of leaving it alone.

View Replies !   View Related
Can I Change The Title Of A Page
Maybe this is a stupid question, but is it possible to randomly change the title of a page with PHP?

View Replies !   View Related
Dynamic Title Issues > Help Please!
Here is my problem: First, I am talking about two files. page.php which serves as the main content page and header.php which contains the obvious header information.

page.php contains the code listed below. I am I am trying to get the <title></title> tag to echo the headline which is described below. The only way of doing this that I have found is copying all of the data below into the head file and placing the <?php echo "?> data into the <title> </title> tags.

That works like a charm! The only problem is I am running into duplicate scripts running which then causes the body (page.php) not to show up. Dynamic titles work fine. Any ideas? Suggestions? Help! Thanks.

<?php
if (!isset($_REQUEST['page'])&&!isset($_REQUEST['story']))
{
header('Location: index.php');
exit;
}

$page = $_REQUEST['page'];
$story = intval($_REQUEST['story']);

include_once('db_fns.php');
include_once('header.php');

$handle = db_connect();
if($story)
{
$query = "select * from stories
where id = '$story' and
published is not null";
}
else
{
$query = "select * from stories
where page = '$page' and
published is not null
order by published desc";
}
$result = $handle->query($query);

while ($story = $result->fetch_assoc())
{
// title
$title = 'Hello!'
// headline
$id = $story['id'];
echo "<a href='page.php?story=$id'><h2>{$story['headline']}</h2></a>";
//picture
if ($story['picture'])
{
echo '<div style="float:right; margin:0px 0px 6px 6px;">'
echo '<img src="resize_image.php?image='
echo urlencode($story[picture]);
echo '&max_width=200&max_height=120" align = right/></div>'
}
// byline
$w = get_writer_record($story['writer']);
echo '<br /><p class="byline">'
echo $w[full_name].', '
echo date('M d, H:i', $story['modified']);
echo '</p>'
// main text
echo $story['story_text'];
}
include_once('footer.php');
?>

View Replies !   View Related
META And TITLE Tags?
I have a bunch of pages, all of which use a common interface. Thus, the site is ideal for implementing some kind of template using the include() function. I want all my pages to look something like the following: PHP Code:

View Replies !   View Related
Puttin Title And Body Into One
I have a field for title/intro and then the main body. Is it possible to put them all together into $post so that I can search thru all of the article instead of just the main body, or how else could I do this. I am wokrin off this tutorial:

http://www.phpbuilder.com/columns/c...421.php3?page=2

View Replies !   View Related
Retrieve <TITLE> In Php Code ?
Simple question, but headache !

I have a PHP Page like :

<HTML>
<HEAD>
<TITLE>Sunny day !</TITLE>
</HEAD>
<BODY>
<?
echo "The title of this page please (Sunny Day !)"
?>
</BODY>
</HTML>

I think that you have understanding my problem : How to retrieve the
title of my page ?

View Replies !   View Related
Page Title Into Database
i am trying to make a script that will get the title of a page amd add it to a database.
PHP Code:

View Replies !   View Related
How Can I Hide A Title Bar In A Nw Window.
I am oening a new window from javascript function

window.open('imgShow.php','ImageName', 'width=100,height=100,titlebar=no,
screenX=' + x + ',screenY=' + y + ',left=' + x + ',top=' + y);

I added titlebar=no Still its showing titlebar.

I want to hide title bar as well as minimise and close option.
I want no border to HTML page. Can anyone suggest me what are the possible options to do this. I have a grid of picture and on mouseover i want to show big image over it.

View Replies !   View Related
Get_meta_tags Prblm If <title> Contains A '
I have a source html file. I use the get_meta_tags function to parse the content of meta,
such as description. It works fine, but in a particolar situation it does not works.
If I have:inside head section:
<title>Il mio nome e' pippo</title> <meta name="description" content="ciao ciao"> then calling PHP Code:

View Replies !   View Related

Copyright © 2005-08 www.BigResource.com, All rights reserved