Re: [PHP] getting HTML header from URL [solved]

2002-11-01 Thread Jule Slootbeek
oops didn't catch two little bugs

Jule

function getTitle($url)
{
	$file = @fopen($url, 'r');

	if(!$file) {
		$rline = "Error, contact webmaster";
	} else {
		while (!feof ($file)) {
 			$line = fgets($file);
 			if (substr_count(strtoupper("$line"), "") >= 1) {
$rline = strip_tags("$line");
//return $rline;
//fclose($file);
break;
			}
	}
	return $rline;
}
	fclose($file);
}

On Friday, Nov 1, 2002, at 20:35 US/Eastern, Jule Slootbeek wrote:


hmm, figured it out...all of a sudden it did work:
here's the code, it loads a URL and returns the title...
dunno what it would be used for, but it aught we some more about php..
i'll probbly implement it on a link page ir something

Jule

function getTitle($url)
{
	$file = @fopen($url, 'r');

	if(!$file) {
		$rline = "Error, contact webmaster";
	} else {
		while (!feof ($file)) {
 			$line = fgets($file);
 			if (substr_count(strtoupper("$line"), "") >= 1) {
$rline = strip_tags("$line");
return $rline;
fclose($file);
break;
			}
	}
	fclose($file);
}


On Friday, Nov 1, 2002, at 20:26 US/Eastern, Jule Slootbeek wrote:


well, i got it to read a html file, but the problem is that it reads 
it after it loads it, so it doesn't read the tags, and i'm looking 
for the string in between  and 
is there a way using fopen()  or something similar to read an 
html/php file before it's loaded?

Jule

On Friday, Nov 1, 2002, at 17:45 US/Eastern, Jule Slootbeek wrote:

i thought fopen() was only for local files, didn't even bother 
looking, but now i think about it..it makes perfect sence to open 
url's as well, thanks a lot!

Jule

On Friday, Nov 1, 2002, at 17:42 US/Eastern, John Nichel wrote:

Docs -> Function Reference -> Filesystem Functions -> fopen()

It was hidden.

Jule Slootbeek wrote:

hey
is there a way to get the URL header? the   tags etc?
i couldn't find any function in the docs, but maybe i just don't 
know where to look.
if there's a function that pulls in an entire page that;s fine too 
i can work with that..
any help appreciated
TIA
Jule
Jule Slootbeek
[EMAIL PROTECTED]



Jule Slootbeek
[EMAIL PROTECTED]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Jule Slootbeek
[EMAIL PROTECTED]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Jule Slootbeek
[EMAIL PROTECTED]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Jule Slootbeek
[EMAIL PROTECTED]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] getting HTML header from URL

2002-11-01 Thread Brendon G
Can't you just call the contents of the page into a variable and extract
what you need with regular expressions?

Php / Html  makes no difference its all text to fopen..

~
> is there a way using fopen()  or something similar to read an html/php
> file before it's loaded?
~~

I'm not sure what you mean here. How can you read anything with out opening
it first?.

Cheers

Brendon


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] getting HTML header from URL [solved]

2002-11-01 Thread Jule Slootbeek
hmm, figured it out...all of a sudden it did work:
here's the code, it loads a URL and returns the title...
dunno what it would be used for, but it aught we some more about php..
i'll probbly implement it on a link page ir something

Jule

function getTitle($url)
{
	$file = @fopen($url, 'r');

	if(!$file) {
		$rline = "Error, contact webmaster";
	} else {
		while (!feof ($file)) {
 			$line = fgets($file);
 			if (substr_count(strtoupper("$line"), "") >= 1) {
$rline = strip_tags("$line");
return $rline;
fclose($file);
break;
			}
	}
	fclose($file);
}


On Friday, Nov 1, 2002, at 20:26 US/Eastern, Jule Slootbeek wrote:


well, i got it to read a html file, but the problem is that it reads 
it after it loads it, so it doesn't read the tags, and i'm looking for 
the string in between  and 
is there a way using fopen()  or something similar to read an html/php 
file before it's loaded?

Jule

On Friday, Nov 1, 2002, at 17:45 US/Eastern, Jule Slootbeek wrote:

i thought fopen() was only for local files, didn't even bother 
looking, but now i think about it..it makes perfect sence to open 
url's as well, thanks a lot!

Jule

On Friday, Nov 1, 2002, at 17:42 US/Eastern, John Nichel wrote:

Docs -> Function Reference -> Filesystem Functions -> fopen()

It was hidden.

Jule Slootbeek wrote:

hey
is there a way to get the URL header? the   tags etc?
i couldn't find any function in the docs, but maybe i just don't 
know where to look.
if there's a function that pulls in an entire page that;s fine too 
i can work with that..
any help appreciated
TIA
Jule
Jule Slootbeek
[EMAIL PROTECTED]



Jule Slootbeek
[EMAIL PROTECTED]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Jule Slootbeek
[EMAIL PROTECTED]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Jule Slootbeek
[EMAIL PROTECTED]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] getting HTML header from URL

2002-11-01 Thread Jule Slootbeek
well, i got it to read a html file, but the problem is that it reads it 
after it loads it, so it doesn't read the tags, and i'm looking for the 
string in between  and 
is there a way using fopen()  or something similar to read an html/php 
file before it's loaded?

Jule

On Friday, Nov 1, 2002, at 17:45 US/Eastern, Jule Slootbeek wrote:

i thought fopen() was only for local files, didn't even bother 
looking, but now i think about it..it makes perfect sence to open 
url's as well, thanks a lot!

Jule

On Friday, Nov 1, 2002, at 17:42 US/Eastern, John Nichel wrote:

Docs -> Function Reference -> Filesystem Functions -> fopen()

It was hidden.

Jule Slootbeek wrote:

hey
is there a way to get the URL header? the   tags etc?
i couldn't find any function in the docs, but maybe i just don't 
know where to look.
if there's a function that pulls in an entire page that;s fine too i 
can work with that..
any help appreciated
TIA
Jule
Jule Slootbeek
[EMAIL PROTECTED]



Jule Slootbeek
[EMAIL PROTECTED]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Jule Slootbeek
[EMAIL PROTECTED]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] getting HTML header from URL

2002-11-01 Thread Jule Slootbeek
i thought fopen() was only for local files, didn't even bother looking, 
but now i think about it..it makes perfect sence to open url's as well, 
thanks a lot!

Jule

On Friday, Nov 1, 2002, at 17:42 US/Eastern, John Nichel wrote:

Docs -> Function Reference -> Filesystem Functions -> fopen()

It was hidden.

Jule Slootbeek wrote:

hey
is there a way to get the URL header? the   tags etc?
i couldn't find any function in the docs, but maybe i just don't know 
where to look.
if there's a function that pulls in an entire page that;s fine too i 
can work with that..
any help appreciated
TIA
Jule
Jule Slootbeek
[EMAIL PROTECTED]



Jule Slootbeek
[EMAIL PROTECTED]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] getting HTML header from URL

2002-11-01 Thread John Nichel
Docs -> Function Reference -> Filesystem Functions -> fopen()

It was hidden.

Jule Slootbeek wrote:

hey

is there a way to get the URL header? the   tags etc?
i couldn't find any function in the docs, but maybe i just don't know 
where to look.
if there's a function that pulls in an entire page that;s fine too i can 
work with that..
any help appreciated
TIA

Jule
Jule Slootbeek
[EMAIL PROTECTED]





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php