Page 1 of 1

HTML extraction .....

Posted: Wed Jul 06, 2005 8:01 pm
by LostOne
I have a variable that has an HTML link in it. Its part of an array returned from a file function. I want to get the hyperlink out of the array. The line in question will contain the information I need and will not change(I hope). What I am trying to do is get the links out of a web page in question. I need to display the daily readings as links on the site I am building......

Code: Select all

<?php
$lines = file('http://www.easterbrooks.com/cgi-bin/Cathcal.cgi?20050706');
foreach ($lines as $line_num => $line) 
{
if($line_num == 55)
	$firstReading =  htmlspecialchars($line);
}
?>
Thankseed and will not change(I hope). What I am trying to do is get the links out of a web page in question. I need to display the daily readings as links on the site I am building......

Code: Select all

<?php
$lines = file('http://www.easterbrooks.com/cgi-bin/Cathcal.cgi?20050706');
foreach ($lines as $line_num => $line) 
{
if($line_num == 55)
	$firstReading =  htmlspecialchars($line);
}
?>
Thanks an array returned from a file function. I want to get the hyperlink out of the array. The line in question will contain the information I need and will not change(I hope). What I am trying to do is get the links out of a web page in question. I need to display the daily readings as links on the site I am building......

Code: Select all

<?php
$lines = file('http://www.easterbrooks.com/cgi-bin/Cathcal.cgi?20050706');
foreach ($lines as $line_num => $line) 
{
if($line_num == 55)
	$firstReading =  htmlspecialchars($lineline in question will contain the information I need and will not change(I hope).  What I am trying to do is get the links out of a web page in question.  I need to display the daily readings as links on the site I am building......

Code: Select all

&lt;?php
$lines = file('http://www.easterbrooks.com/cgi-bin/Cathcal.cgi?20050706');
foreach ($liof an array returned from a file function.  I want to get the hyperlink out of the array.  The line in question will contain the information I need and will not change(I hope).  What I am trying to do is get the links out of a web page in question.  I need to display the daily readings as links on the site I am building......

Code: Select all

<?php
$lines = file('http://www.easterbrooks.com/cgi-bin/Cathcal.cgi?20050706');
foreach ($lines as $line_num => $line) 
{
if($line_num == 55)
	$firstReading =  htmlspecialchars($line);
}
?>
Thanksmp;gt; $line)
{
if($line_num == 55)
$firstReading = htmlspecialchars($line);
}
?>

Thanks $line_num => $line)
{
if($line_num == 55)
$firstReading = htmlspecialchars($line);
}
?>

Thankst of the array. The line in question will contain the information I need and will not change(I hope). What I am trying to do is get the links out of a web page in question. I need to display the daily readings as links on the site I am building......

Code: Select all

&lt;?php
$lines = file('http://www.easterbrooks.com/cgi-bin/Cathcal.cgi?20050706');
foreach (ray.  The line in question will contain the information I need and will not change(I hope).  What I am trying to do is get the links out of a web page in question.  I need to display the daily readings as links on the site I am buildingthat has an HTML link in it.  Its part of an array returned from a file function.  I want to get the hyperlink out of the array.  The line in question will contain the information I need and will not change(I hope).  What I am trying to do is get the links out of a web page in question.  I need to display the daily readings as links on the site I am building......

Code: Select all

<?php
$lines = file('http://www.easterbrooks.com/cgi-bin/Cathcal.cgi?20050706');
foreach ($lines as $line_num => $line) 
{
if($line_num == 55link in it.  Its part of an array returned from a file function.  I want to get the hyperlink out of the array.  The line in question will contain the information I need and will not change(I hope).  What I am trying to do is get the links out of a web page in question.  I need to display the daily readings as links on the site I am building......

Code: Select all

<?php
$lines = file('http://www.easterbrooks.com/cgi-bin/Cathcal.cgido is get the links out of a web page in question.  I need to display the daily readings as links on the site I am building......

Code: Select all

<?php
$lines = file('http://www.easterbrooks.com/cgi-bin/Cathcal.cgi?2nge(I hope).  What I am trying to do is get the links out of a web page in question.  I need to display the daily readings as links on the site I am building......

Code: Select all

<?php
$lines = file('http://www.easterbrooks.com/cgi-bin/Cathcal.cgi?20050706');
foreach ($lines as $line_num => $line) 
{
if($line_num == 55)
	$firstReading =  htmlspecialchars($line);
}
?>
Thanksned from a file function. I want to get the hyperlink out of the array. The line in question will contain the information I need and will not change(I hope). What I am trying to do is get the links out of a web page in question. I need to display the daily readings as links on the site I am building......

Code: Select all

<?php
$lines = file('http://www.easterbrooks.com/cgi-bin/Cathcal.cgi?20050706');
foreach ($lines as $line_num => $line) 
{
if($line_num == 55)
	$firstReading =  htmlspecialchars($line);
}
?>
Thanksthe links out of a web page in question. I need to display the daily readings as links on the site I am building......

Code: Select all

<?php
$lines = file('http://www.easterbrooks.com/cgi-bin/Cathcal.cgi?20050706');
foreach ($lines as $line_num =&amwant to get the hyperlink out of the array.  The line in question will contain the information I need and will not change(I hope).  What I am trying to do is get the links out of a web page in question.  I need to display the daily readings as links on the site I am building......

Code: Select all

&lt;?php
$lines = file('httpthat has an HTML link in it.  Its part of an array returned from a file function.  I want to get the hyperlink out of the array.  The line in question will contain the information I need and will not change(I hope).  What I am trying to do is get the links out of a web page in question.  I need to display the daily readings as links on the site I am building......

Code: Select all

<?php
$lines = file('http://www.easterbrooks.com/cgi-bin/Cathcal.cgi?20050706');
foreach ($lines as $line_num => $line) 
{
if($line_num == 55)
	$firstReading =  htmlspecialchars($line);
}
?>
Thanksin it. Its part of an array returned from a file function. I want to get the hyperlink out of the array. The line in question will contain the information I need and will not change(I hope). What I am trying to do is get the links out of a web page in question. I need to display the daily readings as links on the site I am building......

Code: Select all

<?php
$lines = file('http://www.easterbrooks.com/cgi-bin/Cathcal.cgi?20050706');
foreach ($lines as $line_num => $line) 
{
if($line_num == 55)
	$firstReading =  htmlspecialchars($line);
}
?>
Thanksot change(I hope). What I am trying to do is get the links out of a web page in question. I need to display the daily readings as links on the site I am building......

Code: Select all

&lt;?php
$lines = file('http://www.easterbrooks.com/cgi-  Its part of an array returned from a file function.  I want to get the hyperlink out of the array.  The line in question will contain the information I need and will not change(I hope).  What I am trying to do is get the links out of a web page in question.  I need to display the daily readings as links on the site I am building......

Code: Select all

<?php
$lines = file('http://www.easterbrooks.com/cgi-bin/Cathcal.cgi?20050706');
foreach ($lines as $line_num => $line) 
{
if($line_num == 55)
	$firstReading =  htmlspecialchars($line);
}
?>
Thanksily readings as links on the site I am building......

Code: Select all

<?php
$lines = file('http://www.easterbrooks.com/cgi-bin/Cathcal.cgi?20050706');
foreach ($lines as $line_num => $line) 
{
if($line_num == 55)
	$firstReading =  htmlspecialchars($line);
}
?>
Thanksy returned from a file function. I want to get the hyperlink out of the array. The line in question will contain the information I need and will not change(I hope). What I am trying to do is get the links out of a web page in question. I need to display the daily readings as links on the site I am building......

Code: Select all

&lt;?php
$lines = file(nk out of the array.  The line in question will contain the information I need and will not change(I hope).  What I am trying to do is get the links out of a web page in question.  I need to display the daily readings as links on the site I am building......

Code: Select all

<?php
$lines = file('http://www.easterbrooks.com/cgi-bin/Cathcal.cgi?20050706');
foreach ($lines as $line_num => $line) 
{
if($line_num == 55)
	$firstReading =  htmlspecialchars($line);
}
?>
Thanksthat has an HTML link in it. Its part of an array returned from a file function. I want to get the hyperlink out of the array. The line in question will contain the information I need and will not change(I hope). What I am trying to do is get the links out of a web page in question. I need to display the daily readings as links on the site I am building......

Code: Select all

&lt;?php
$lines = file('http://www.easterbrooks.com/cgi-bin/Cathcal.cgi?20050706');
foreach ($lines as $line_num =&gt; $line) 
{
if($line_num == 55)
	$firstReading =  htmlspecialchars($line);
}
  I want to get the hyperlink out of the array.  The line in question will contain the information I need and will not change(I hope).  What I am trying to do is get the links out of a web page in question.  I need to display the daily readings as links on the site I am building......
[php:1:d7ef to get the hyperlink out of the array.  The line in question will contain the information I need and will not change(I hope).  What I am trying to do is get the links out of a web page in question.  I need to display the daily readings as links on the site I am building......

Code: Select all

&lt;?php
$lines = file('http hyperlink out of the array.  The line in question will contain the information I need and will not change(I hope).  What I am trying to do is get the links out of a web page in question.  I need to display the daily readings as links on the site I am building......

Code: Select all

<?php
$lines = file('http://www.easterbrooks.com/cgi-bin/Cathcal.cgi?20050706');
foreach ($lines as $line_num => $line) 
{
if($line_num == 55)
	$firstReading =  htmlspecialchars($line);
}
?>
Thanksthat has an HTML link in it. Its part of an array returned from a file function. I want to get the hyperlink out of the array. The line in question will contain the information I need and will not change(I hope). What I am trying to do is get the links out of a web page in question. I need to display the daily readings as links on the site I am building......

Code: Select all

<?php
$lines = file('http://www.easterbrooks.com/cgi-bin/Cathcal.cgi?20050706');
foreach ($lines as $line_num => $line) 
{
if($line_num == 55)
	$firstReading =  htmlspecialchars($line);
}
?>
Thanksed from a file function. I want to get the hyperlink out of the array. The line in question will contain the information I need and will not change(I hope). What I am trying to do is get the links out of a web page in question. I need to display the daily readings as links on the site I am building......
[php:1:d7efthat has an HTML link in it. Its part of an array returned from a file function. I want to get the hyperlink out of the array. The line in question will contain the information I need and will not change(I hope). What I am trying to do is get the links out of a web page in question. I need to display the daily readings as links on the site I am building......

Code: Select all

&lt;?php
$lines = file('http://wnction.  I want to get the hyperlink out of the array.  The line in question will contain the information I need and will not change(I hope).  What I am trying to do is get the links out of a web page in question.  I need to display the daily readings as links on the site I am building......

Code: Select all

& Its part of an array returned from a file function.  I want to get the hyperlink out of the array.  The line in question will contain the information I need and will not change(I hope).  What I am trying to do is get the links out of a web page in question.  I need to display the daily readings as links on the site I am building......

Code: Select all

<?php
$lines = file('http://www.easterbrooks.com/cgi-bin/Cathcal.cgi?20050706');
foreach ($lines as $line_num => $line) 
{
if($line_num == 55)
	$firstReading =  htmlspecialchars($line);
}
?>
Thanks<?php
$lines = file('http://www.easterbrooks.com/cgi-bin/Cat ... i?20050706');
foreach ($lines as $line_num => $line)
{
if($line_num == 55)
$firstReading = htmlspecialchars($line);
}
?>

Thanksdaily readings as links on the site I am building......

Code: Select all

<?php
$lines = file('http://www.easterbrooks.com/cgi-bin/Cathcal.cgi?20050706');
foreach ($lines as $line_num => $line) 
{
if($line an array returned from a file function.  I want to get the hyperlink out of the array.  The line in question will contain the information I need and will not change(I hope).  What I am trying to do is get the links out of a web page in question.  I need to display the daily readings as links on the site I am building......
[from a file function.  I want to get the hyperlink out of the array.  The line in question will contain the information I need and will not change(I hope).  What I am trying to do is get the links out of a web page in question.  I need to display the daily readings as links on the site I am building......

Code: Select all

&lt;?php
$lines = file('http://www.easterbrooks.com/cgi-bithat has an HTML link in it.  Its part of an array returned from a file function.  I want to get the hyperlink out of the array.  The line in question will contain the information I need and will not change(I hope).  What I am trying to do is get the links out of a web page in question.  I need to display the daily readings as links on the site I am building......

Code: Select all

<?php
$lines = file('http://www.easterbrooks.com/cgi-bin/Cathcal.cgi?20050706');
foreach ($lines as $line_num => $line) 
{
if($line_num == 55)
	$firstReading =  htmlspecialchars($line);
}
?>
Thanksl not change(I hope). What I am trying to do is get the links out of a web page in question. I need to display the daily readings as links on the site I am building......

Code: Select all

<?php
$lines = file('http://www.easterbrooks.com/cgi-bin/Cathcal.cgi?20050706');
foreach ($lines as $line_num => $line) 
{
if($line_num == 55)
	$firstReading =  htmlspecialchars($line);
}
?>
Thanks

Posted: Wed Jul 06, 2005 8:06 pm
by Burrito
use PHP tags you should when posting code...

use a regular expression you should to extract the links.

posted in the regex forum this should be 8O

try something like this you could:

Code: Select all

$pattern = "#<a href=\"(*.?)\">(*.?)</a>#";
38fa3bf93c]
$pattern = "#<a href=\"(*.?)\">(*.?)</a>#";
ar expression you should to extract the links.

posted in the regex forum this should be 8O

try something like this you could:

Code: Select all

$pattern = "#<a href=\"(*.?)\">(*.?)</a>#";
O

try something like this you could:
[php:1:38fa3bf93ular expression you should to extract the links.

posted in the regex forum this should be 8O

try something like this you could:

Code: Select all

$pattern = "#<a href=\"(*.?)\">(*.?)</a>#";
rum this should be 8O

try something like this you could:

Code: Select all

$pattern = "#<a href=\"(*.?)\">(ould be   

try something like this you could:

Code: Select all

$pattern = "#<a href=\"(*.?)\">(*.?)&amhould when posting code...

use a regular expression you should to extract the links.

posted in the regex forum this should be   

try something like this you could:

Code: Select all

$pattern = "#<a href=\"(*.?)\">(*.?)</a>#";
g code...

use a regular expression you should to extract the links.

posted in the regex forum this should be 8O

try something like this you could:

Code: Select all

$pattern = "#<a href=\"(*.?)\">(*.?)</a>#";
=\"(*.?)\">(*.?)</a>#";
n = "#<a href=\"(*.?)\">(*.?)</a>#";
ou should to extract the links.

posted in the regex forum this should be 8O

try something like this you could:

Code: Select all

$pattern = "#<a href=\"(*.?)\">(*.?)</a>#";
te;(*.?)\">(*.?)</a>#";
s.

posted in the regex forum this should be 8O

try something like this you could:

Code: Select all

$pattern = "#&amhould when posting code...

use a regular expression you should to extract the links.

posted in the regex forum this should be   

try something like this you could:

Code: Select all

$pattern = &quote;#&lt;a href=\&quote;(*.?)\&quote;&gt;(*.?)</a>#";
e...

use a regular expression you should to extract the links.

posted in the regex forum this should be 8O

try something like this you could:

Code: Select all

$pattern = "#<a href=\"(*.?)\">(*.?)</a>#";
pattern = "#<a href=\"(*.?)\"&gt;(*.?)&lt;/a>#";

use a regular expression you should to extract the links.

posted in the regex forum this should be 8O

try something like this you could:

Code: Select all

$pattern = "#<a href=\"(*.?)\">(*.?)</a>#";
mp;quote;;
ssion you should to extract the links.

posted in the regex forum this should be 8O

try something like this you could:

Code: Select all

$pattern = "#<a href=\"(*.?)\">(*.?)</a>#";
[/php:1:38ex forum this should be   

try something like this you could:

Code: Select all

$pattern = "#<a href=\"(*.?)\">(*.?)</a>#";
hould when posting code...

use a regular expression you should to extract the links.

posted in the regex forum this should be 8O

try something like this you could:

Code: Select all

$pattern = &quote;#&lt;a href=\&quote;(*.?)\&quote;&gt;(*.?)&lt;/a&amplinks.

posted in the regex forum this should be   

try something like this you could:

Code: Select all

$pattern = "#<a href=\"(*.?)\">(*.?)</a>#";
posted in the regex forum this should be 8O

try something like this you could:

Code: Select all

$pattern = "#<a href=\"(*.?)\">(*.?)</a>#" the regex forum this should be   

try something like this you could:

Code: Select all

$pattern = "#<a href=\"(*.?)\">(*.?)</a>#";
hould when posting code...

use a regular expression you should to extract the links.

posted in the regex forum this should be 8O

try something like this you could:

Code: Select all

$pattern = "#<a href=\"(*.?)\">(*.?)</a>#";
u should to extract the links.

posted in the regex forum this should be 8O

try something like this you could:

Code: Select all

$pattern = "#<a href=\"(*.?)\">(*.?)</a>#";
hould when posting code...

use a regular expression you should to extract the links.

posted in the regex forum this should be 8O

try something like this you could:

Code: Select all

$pattern = "#<a href=\"(*.?)\">(*.?)&ampct the links.

posted in the regex forum this should be   

try something like this you could:

Code: Select all

$pattern = "#<a href=\"(*.?)\">
use a regular expression you should to extract the links.

posted in the regex forum this should be   

try something like this you could:

Code: Select all

$pattern = "#<a href=\"(*.?)\">(*.?)</a>#";
";
ar expression you should to extract the links.

posted in the regex forum this should be 8O

try something like this you could:

Code: Select all

$pattern = "#<a href=\"(*.?)\">(*.?)</a>#";
hould to extract the links.

posted in the regex forum this should be 8O

try something like this you could:
[php:1:38fa3bf93hould when posting code...

use a regular expression you should to extract the links.

posted in the regex forum this should be 8O

try something like this you could:

Code: Select all

$pattern = "#<a href=\"(*.?)\">(*.?)</a>#";
$pattern = "#<a href=\"(*.?)\">(*.?)</a>#";

Posted: Wed Jul 06, 2005 8:18 pm
by LostOne
no idea what this error is

Warning: preg_match_all(): Compilation failed: nothing to repeat at offset 11 :roll:

this is what is returned => First Reading: <A HREF="http://www.easterbrooks.com/cgi-bin/Bib ... =paragraph" TARGET="_new">Genesis 41:55-57; 42:5-7, 17-24</A><BR>

Posted: Wed Jul 06, 2005 8:29 pm
by Burrito
doh, try this:

just tested it I did, works it does...

Code: Select all

$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
forgot the order of ".*?" I did...quote;;


forgot the order of ".*?" I did...

Code: Select all

$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
forgot the order of ".*?" I did...amp;gt;(.*?)</a>#i";

Code: Select all

$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
forgot the order of ".*?" I did...te;(.*?)\">(.*?)</a>#i";


forgot the order of ".*?" I did...mp;quote;>(.*?)</a>#i";


forgot the order of ".*?" I did...just tested it I did, works it does...

Code: Select all

$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
forgot the order of ".*?" I did...did, works it does...

Code: Select all

$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
forgot the order of ".*?" I did...*?" I did...4849e89]

forgot the order of ".*?" I did...e89]
$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";


forgot the order of ".*?" I did.....<a href=\"(.*?)\">(.*?)</a>#i";


forgot just tested it I did, works it does...

Code: Select all

$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
forgot the order of ".*?" I did...works it does...

Code: Select all

$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
forgot the order of ".*?" I did...]

forgot the order of ".*?" I did...it does...

Code: Select all

$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
forgot the order of ".*?" I did...c984849e89]
$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";


forgot the order of ".*?" I did...p;quote;(.*?)\">(.*?)</a>#i";


forgot the order of ".*?" I did...just tested it I did, works it does...

Code: Select all

$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
[/php:1:c984849te;#<a href=\"(.*?)\">(.*?)</a>#i";
forgot the order of ".*?" I did...;amp;lt;a href=\"(.*?)\">(.*?)</a>#i";


forgot the order of ".*?" I did...ref=\"(.*?)\">(.*?)</a>#i";


forgot the order of ".*?" I did...just tested it I did, works it does...

Code: Select all

$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
forgot the order of ".*?" I did...89]
$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";


forgot the order of ".*?" I did...just tested it I did, works it does...

Code: Select all

$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
forgot the order of ".*?" I did...amp;quote;#<a href=\"(.*?)\">(.*?)</a>#i";


forgot the order of ".*?" I did...t does...

Code: Select all

$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
forgot the order of ".*?" I did...

Code: Select all

$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
forgot the order of ".*?" I did...
$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";


forgot the order of ".*?" I did...

Posted: Wed Jul 06, 2005 8:42 pm
by LostOne
I must be a complete idiot all I get is

Code: Select all

$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
preg_match_all($pattern, $firstReading, $matches);
		
echo "<pre>";
print_r($matches);
echo "</pre>";
this is my output

Array
(
[0] => Array
(
)

[1] => Array
(
)

[2] => Array
(
)

)_all($pattern, $firstReading, $matches);

echo "<pre>";
print_r($matches);
echo "</pre>";




this is my output

Array
(
[0] => Array
(
)

[1] => Array
(
)

[2] => Array
(
)

)
$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
preg_match_all($pattern, $firstReading, $matches);

echo "<pre>";
print_r($matches);
echo "</pre>";




this is my output

Array
(
[0] => Array
(
)

[1] => Array
(
)

[2] => Array
(
)

)p;amp;lt;/a>#i";
preg_match_all($pattern, $firstReading, $matches);

echo &quote;&lt;pre&gt;&quote;;
print_r($matches);
echo &quote;&lt;/pre&gt;&quote;;




this is my output

Array9]
$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
preg_match_all($pattern, $firstReading, $matches);

echo "<pre>";
print_r($matches);
echo "</pre>";




this is my output

Array
(
[0] => Array
(
)

[1] => Array
(
)

[2] => Array
(
)

)

[2] => Array
(
)

) (
)

[2] => Array
(
)

);>(.*?)</a>#i";
preg_match_all($pattern, $firstReading, $matches);

echo "<pre>&quote;;
print_r($matches);
echo &quote;&lt;/pre&gt;&quote;;




this is my output

Art;(.*?)</a>#i";
preg_match_all($pattern, $firstReading, $matches);

echo "<pre>";
pte idiot all I get is

Code: Select all

$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
preg_match_all($pattern, $firstReading, $matches);
		
echo "<pre>";
print_r($matches);
echo "</pre>";
this is my output

Array
(
[0] => Array
(
)

[1] => Array
(
)

[2] => Array
(t is

Code: Select all

$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
preg_match_all($pattern, $firstReading, $matches);
		
echo "<pre>";
print_r($matches);
echo "</pre>";
this is my output

Array
(
[0] => Array
(
)p;quote;<pre>";
print_r($matches);
echo "</pre>";




this is my output

Array
(
[0] => Array
(
)
tReading, $matches);

echo "<pre>";
print_r($matches);
echo "</pre>";




this is my output

Array
(
[0] => Array
(
)

[1] => Array
(
)

[2] => Array
(
)

)mp;quote;#<a href=\"(.*?)\">(.*?)</a>#i";
preg_match_all($pattern, $firstReading, $matches);

echo "<pre>";
print_r($matches);
echo "</pre>";




this is my output

Array
(
[0] => Array
(
)

[1] => Array
(
)

[2] => Array
(
)

)mp;amp;lt;pre>";
print_r($matches);
echo "</pre>";




this is my output

Array
(
[0] => Array
(
)

[1] => Array
(
)
\"(.*?)\">(.*?)</a>#i";
preg_match_all($pattern, $firstReading, $matches);

echo &quote;&lt;pre&gt;&quote;;
print_r($matches);
echo &quote;&lt;/pre&gtte idiot all I get is

Code: Select all

$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
preg_match_all($pattern, $firstReading, $matches);
		
echo "<pre>";
print_r($matches);
echo "</pre>";
this is my output

Array
(
[0] => Array
(
)

[1] => Array
(
)

[2] => Array
(
)

)

Code: Select all

$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
preg_match_all($pattern, $firstReading, $matches);
		
echo "<pre>";
print_r($matches);
echo "</pre>";
this is my output

Array
(
[0] => Array
(
)

[1] => Array
(
)

[2] => Array
(
)

) $firstReading, $matches);

echo "<pre>&quote;;
print_r($matches);
echo "</pre>";




this is my output

Array
(
[0] => Array
1]
$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
preg_match_all($pattern, $firstReading, $matches);

echo "<pre>";
print_r($matches);
echo "</pre>";




this is my output

Array
(
[0] => Array
(
)

[1] => Array
(
)

[2] => Array
(
)

)mp;quote;</pre>";




this is my output

Array
(
[0] => Array
(
)

[1] => Array
(
)

[2] => Array
(
)

)rn = "#<a href=\"(.*?)\">(.*?)</a>#i";
preg_match_all($pattern, $firstReading, $matches);

echo "<pre>";
print_r($matches);
echo "</pre&aquote;>(.*?)</a>#i";
preg_match_all($pattern, $firstReading, $matches);

echo "<pre>";
print_r($matches);
echo "</pre&gt;&quote;;




this is my output

Array
(
[0] => Array
(
)

[1] => Array
(
)

[2] => Array
(
)

)te idiot all I get is

Code: Select all

$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
preg_match_all($pattern, $firstReading, $matches);
		
echo "<pre>";
print_r($matches);
echo "</pre>";
this is my output

Array
(
[0] => Array
(
)

[1] => Array
(
)

[2] ref=\"(.*?)\">(.*?)</a>#i";
preg_match_all($pattern, $firstReading, $matches);

echo "<pre>";
print_r($matches);
echo "</pre>&qup;quote;(.*?)\">(.*?)</a>#i";
preg_match_all($pattern, $firstReading, $matches);

echo "<pre>";
print_r($matches);
echo "&lt;/pre&gt?)\">(.*?)</a>#i";
preg_match_all($pattern, $firstReading, $matches);

echo "<pre>";
print_r($matches);
echo "</pre&gt;&quote;;




this is my output

Array
(
[0] => Array
(
)

[1] => Array
(
)

[2] => Array
(
)

)te idiot all I get is

Code: Select all

$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
preg_match_all($pattern, $firstReading, $matches);
		
echo "<pre>";
print_r($matches);
echo "</pre>";
this is my output

Array
(
[0] => Array
(
)

[1] => Array
(
)

[2] => Array
(
)

)p;quote;#<a href=\"(.*?)\">(.*?)</a>#i";
preg_match_all($pattern, $firstReading, $matches);

echo "<pre>";
print_r($matches);
echo "</pre>";


[/php:1:89te idiot all I get is

Code: Select all

$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
preg_match_all($pattern, $firstReading, $matches);
		
echo "<pre>";
print_r($matches);
echo &quote;&lt;/pre&gt;&am;lt;a href=\"(.*?)\">(.*?)</a>#i";
preg_match_all($pattern, $firstReading, $matches);
		
echo "<pre>&quote;;
print_r($matches);
echo &quote]
$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
preg_match_all($pattern, $firstReading, $matches);
		
echo "<pre>";
print_r($matches);
echo "</pre>";
this is my output

Array
(
[0] => Array
(
)

[1] => Array
(
)

[2] => Array
(
)

)

this is my output

Array
(
[0] => Array
(
)

[1] => Array
(
)

[2] => Array
(
)

)"</pre>";




this is my output

Array
(
[0] => Array
(
)

[1] => Array
(
)

[2] => Array

$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
preg_match_all($pattern, $firstReading, $matches);

echo "<pre>";
print_r($matches);
echo "</pre>";




this is my output

Array
(
[0] => Array
(
)

[1] => Array
(
)

[2] => Array
(
)

)

Posted: Wed Jul 06, 2005 10:41 pm
by Burrito

Code: Select all

<?
$link = "<a href=\"http://www.bob.com\">bobby</a>";
$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
preg_match($pattern,$link,$matches);
echo $matches[1];
echo "<br>".$matches[2];
?>

/*
yields:
http://www.bob.com
bobby
*/
show me your $firstReading var you should...mp;lt;a href=\"(.*?)\">(.*?)</a>#i";
preg_match($pattern,$link,$matches);
echo $matches[1];
echo "<br>".$matches[2];
?>

/*
yields:
http://www.bob.com
bobby
*/


show me your $firstReading var you should...amp;lt;a href=\"http://www.bob.com\">bobby</a>";
$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
preg_match($pattern,$link,$matches);
echo $matches[1];
echo "<br>".$matches[2];
?>

/*
yields:
http://www.bob.com
bobby
*/


show me your $firstReading var you should...mp;gt;";
$pattern = "#<a href=\&quote;(.*?)\&quote;&gt;(.*?)&lt;/a&gt;#i&quote;;
preg_match($pattern,$link,$matches);
echo $matchesї1];
echo &quote;&lt;br&gt;&qup;amp;lt;a href=\"http://www.bob.com\">bobby</a>";
$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
preg_match($pattern,$link,$matches);
echo $matches[1];
echo "<br>".$matches[2];
?>

/*
yields:
http://www.bob.com
bobby
*/


show me your $firstReading var you should...$firstReading var you should...]

show me your $firstReading var you should...y</a>";
$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i&quote;;
preg_match($pattern,$link,$matches);
echo $matchesї1];
echo &quote;&lt;br&gt;&ampt;/a>";
$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
pre
<?
$link = "<a href=\"http://www.bob.com\">bobby</a>";
$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
preg_match($pattern,$link,$matches);
echo $matches[1];
echo "<br>".$matches[2];
?>

/*
yields:
http://www.bob.com
bobby
*/


show me your $firstReading var you should...$link = "<a href=\"http://www.bob.com\&quote;&gt;bobby&lt;/a&gt;&quote;;
$pattern = &quote;#&lt;a href=\&quote;(.*?)\&quote;&gt;(.*?)</a>#i";
preg_match($pattern,$link,$matches);
echo $matches[1];
echo "<br>".$matches[2];
?>

/*
yields:
http://www.bob.co(.*?)</a>#i";
preg_match($pattern,$link,$matches);
echo $matches[1];
echo "<br>".$matches[2];
?>

/*
yields:
http://www.bob.com
uote;(.*?)\">(.*?)</a>#i";
preg_match($pattern,$link,$matches);
echo $matches[1];
echo "<br>".$matches[2];
?>

/*
yields:
http://www.bob.com
bobby
*/


show me your $firstReading var you should..."http://www.bob.com\">bobby</a>";
$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
preg_match($pattern,$link,$matches);
echo $matches[1];
echo "<br>".$matches[2];
?>

/*
yields:
http://www.bob.com
bobby
*/


show me your $firstReading var you should...amp;lt;/a>#i";
preg_match($pattern,$link,$matches);
echo $matches[1];
echo "<br>".$matches[2];
?>

/*
yields:
http://www.bob.com
bobby
*/


show me your $\">bobby</a>";
$pattern = "#<a href=\"(.*?)\&quote;&gt;(.*?)&lt;/a&gt;#i&quote;;
preg_match($pattern,$link,$matches);
echo
<?
$link = "<a href=\"http://www.bob.com\">bobby</a>&quote;;
$pattern = &quote;#&lt;a href=\&quote;(.*?)\&quote;&gt;(.*?)&lt;/a&gt;#i&quote;;
preg_match($pattern,$link,$matches);
echo $matches[1];
echo "<br>".$matches[2];
?>

/*
yields:
http://www.bob.com
bobby
*/


show me your $firstReading var you should... = "<a href=\"http://www.bob.com\">bobby</a>";
$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
preg_match($pattern,$link,$matches);
echo $matches[1];
echo "<br>".$matches[2];
?>

/*
yields:
http://www.bob.com
bobby
*/


show me your $firstReading var you should..."(.*?)\">(.*?)</a>#i&quote;;
preg_match($pattern,$link,$matches);
echo $matches[1];
echo "<br&gt;&quote;.$matchesї2];
?&gt;

/*
yields:
htp;quote;<a href=\"http://www.bob.com\">bobby</a>";
$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
preg_match($pattern,$link,$matches);
echo $matches[1];
echo "<br>".$matches[2];
?>

/*
yields:
http://www.bob.com
bobby
*/


show me your $firstReading var you should...tches);
echo $matches[1];
echo "<br>".$matches[2];
?>

/*
yields:
http://www.bob.com
bobby
*/


show me your $firstReading var you should... href=\"http://www.bob.com\">bobby</a>";
$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
preg_match($pattern,$link,$matches);
echo $matches;bobby</a>";
$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
preg_match($pattern,$link,$matches);
echo $matchesї1];
echo &quote;&lt;br&gt;".$matches[2];
?>

/*
yields:
http://www.bob.com
bobby
*/


show me your $firstReading var you should...
<?
$link = "<a href=\"http://www.bob.com\">bobby</a&gt;&quote;;
$pattern = &quote;#&lt;a href=\&quote;(.*?)\&quote;&gt;(.*?)&lt;/a&gt;#i&quote;;
preg_match($pattern,$link,$matches);
echo $matchesї1];
echo &quote;&lt;br&gt;&quote;.$matchesї2];
?&gt;

/*
yields:
http://www.bob.com
bobby
*/


sh.com\">bobby</a>";
$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
preg_match($pattern,$link,$matches);
echo $matches[1];
echo &p;quote;>bobby</a>";
$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
preg_match($pattern,$link,$matches);
echo p;amp;gt;bobby</a>";
$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
preg_match($pattern,$link,$matches);
echo $matchesї1];
echo &quote;&lt;br&gt;&quote;.$matchesї2];
?&gt;

/*
yields:
http://www.bob.com
bobby
*/


show me your $firstReading var you should...
<?
$link = "<a href=\"http://www.bob.com\">bobby</a>";
$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
preg_match($pattern,$link,$matches);
echo $matches[1];
echo "<br>".$matches[2];
?>

/*
yields:
http://www.bob.com
bobby
*/


show me your $firstReading var you should...

Posted: Wed Jul 06, 2005 11:33 pm
by John Cartwright
Moved to Regex.
d11 | wha? Databases? :?

Posted: Thu Jul 07, 2005 4:13 am
by LostOne
Here is all the code

Code: Select all

<?php 
						$lines = file('http://www.easterbrooks.com/cgi-bin/Cathcal.cgi?20050706');
						  
						foreach ($lines as $line_num => $line) 
						{
						 if($line_num == 55)
							echo $firstReading =  htmlspecialchars($line);
						}
						$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
						preg_match_all($pattern, $firstReading, $matches);
							
						echo "<pre>";
						print_r($matches);
						echo "</pre>";
						?>
first reading will echo the following code =>
$firstReading = First Reading: <A HREF="http://www.easterbrooks.com/cgi-bin/Bib ... =paragraph" TARGET="_new">Genesis 41:55-57; 42:5-7, 17-24</A><BR>

My results of the print_r($matches) is =>
Array
(
[0] => Array
(
)

[1] => Array
(
)

[2] => Array
(
)

)

what I am trying to do is get all the hyperlinks out of a web page.mp;gt; $line)
{
if($line_num == 55)
echo $firstReading = htmlspecialchars($line);
}
$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
preg_match_all($pattern, $firstReading, $matches);

echo "<pre>";
print_r($matches);
echo "</pre>";
?>



first reading will echo the following code =>
$firstReading = First Reading: <A HREF="http://www.easterbrooks.com/cgi-bin/Bib ... =paragraph" TARGET="_new">Genesis 41:55-57; 42:5-7, 17-24</A><BR>

My results of the print_r($matches) is =>
Array
(
[0] => Array
(
)

[1] => Array
(
)

[2] => Array
(
)

)

what I am trying to do is get all the hyperlinks out offirstReading = First Reading: <A HREF="http://www.easterbrooks.com/cgi-bin/Bib ... =paragraph" TARGET="_new">Genesis 41:55-57; 42:5-7, 17-24</A><BR>

My results of the print_r($matches) is =>
Array
(
[0] => Array
(
)

[1] => Array
(
)

[2] => Array
(
)

)

what I am tryi;?php
$lines = file('http://www.easterbrooks.com/cgi-bin/Cat ... i?20050706');

foreach ($lines as $line_num => $line)
{
if($line_num == 55)
echo $firstReading = htmlspecialchars($line);
}
$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
preg_match_all($pattern, $firstReading, $matches);

echo "<pre>";
print_r($matches);
echo &quote;&lt;/pre&gt;&quote;;
?&gt;



first reading will echo the following code =>
$firstReading = First Reading: <A HREF="http://www.easterbr
foreach ($lines as $line_num => $line)
{
if($line_num == 55)
echo $firstReading = htmlspecialchars($line);
}
$pattern = &quote;#&lt;a href=\&quote;(.*?)\&quote;&gt;(.*?)&lt;/a&gt;#i&quote;;
preg_match_all($pattern, $firstReading, $matches);

echo &quote;&lt;pre&gt;&quote;;
print_r($matches);
echo &quote;&lt;/pre&gt;&quote;;
?&gt;



first reading will echo the following code =>
$firstReading = First Reading: <A HREF="http://www.easterbrooks.com/cgi-bin/Bib ... =paragraph" TARGET="_new">Genesis 41:55-57; 42:5-7, 17-24</A><BR>

My results of the print_r($matches) is =>
Array
(
[0] => Array
(
)

[1] =>lt;?php
$lines = file('http://www.easterbrooks.com/cgi-bin/Cat ... i?20050706');

foreach ($lines as $line_num => $line)
{
if($line_num == 55)
echo $firstReading = htmlspecialchars($line);
}
$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
preg_match_all($pattern, $firstReading, $matches);

echo "<pre>";
print_r($matches);
echo "</pre>";
?>



first reading will echo the following code =>
$firstReading = First Reading: <A HREF="http://www.easterbrooks.com/cgi-bin/Bib ... =paragraph" TARGET="_new">Genesis 41:55-57; 42:5-7, 17-24</A><BR>

My results of the print_r($matches) is =>
Array
(
[0] => Array
(
)

[1] => Array
(
)

[2] => Array
(
)

)

what I am trying to do is get all the hyperlinks out of a web page.;quote;<pre>";
print_r($matches);
echo "</pre>";
?>



first reading will echo the following code =>
$firstReading = First Reading: <A HREF="http://www.easterbrooks.com/cgi-bin/Bib ... =paragraph" TARGET="_new">Genesis 41:55-57; 42:5-7, 17-24</A><BR>

My results of the print_r($matches) is =>
Array
(
[0] => Array
(
)

[1] => Array
(
)

[2] => Array
(
)

)

what I am trying to do is get all the hyperlinks out of a web page.
echo "<pre>";
print_r($matches);
echo "</pre>";
?>



first reading will echo the following code =>
$firstReading = First Reading: <A HREF="http://www.easterbrooks.com/cgi-bin/Bib ... =paragraph" TARGET="_new">Genesis 41:55-57; 42:5-7, 17-24</A><BR>

My results of the print_r($matches) is =>
Array
(
[0] => Array
(
)

[1] => Array
(
)

[2] => Array
(
)

)

what I am trying to do is get all the hyperlinks out of a web page..cgi?20050706');

foreach ($lines as $line_num => $line)
{
if($line_num == 55)
echo $firstReading = htmlspecialchars($line);
}
$pattern = &quote;#&lt;a href=\&quote;(.*?)\&quote;&gt;(.*?)&lt;/a&gt;#i&quote;;
preg_match_all($pattern, $firstReading, $matches);

echo &quote;&lt;pre&gt;&quote;;
print_r($matches);
echo &quote;&lt;/pre&gt;&quote;;
?&gt;



first reading will echo the following code =>
$firstReading = First Reading: <A HREF="http://www.easterbrooks.com/cgi-bin/Bib ... =paragraph" TARGET="_new">Genesis 41:55-57; 42:5-7, 17-24</A><BR>

My results of the print_r($matches) is =>
Array
(
[0] => Array
(
)

[1] =&06');

foreach ($lines as $line_num => $line)
{
if($line_num == 55)
echo $firstReading = htmlspecialchars($line);
}
$pattern = &quote;#&lt;a href=\&quote;(.*?)\&quote;&gt;(.*?)&lt;/a&gt;#i&quote;;
preg_match_all($pattern, $firstReading, $matches);

echo &quote;&lt;pre&gt;&quote;;
print_r($matches);
echo &quote;&lt;/pre&gt;&quote;;
?&gt;



first reading will echo the following code =>
$firstReading = First Reading: <A HREF="http://www.easterbrooks.com/cgi-bin/Bib ... =paragraph" TARGET="_new">Genesis 41:55-57; 42:5-7, 17-24</A><BR&ampde

Code: Select all

<?php 
						$lines = file('http://www.easterbrooks.com/cgi-bin/Cathcal.cgi?20050706');
						  
						foreach ($lines as $line_num => $line) 
						{
						 if($line_num == 55)
							echo $firstReading =  htmlspecialchars($line);
						}
						$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
						preg_match_all($pattern, $firstReading, $matches);
							
						echo "<pre>";
						print_r($matches);
						echo "</pre>";
						?>
first reading will echo the following code =&a127d]
<?php
$lines = file('http://www.easterbrooks.com/cgi-bin/Cat ... i?20050706');

foreach ($lines as $line_num =&gt; $line)
{
if($line_num == 55)
echo $firstReading = htmlspecialchars($line);
}
$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
preg_match_all($pattern, $firstReading, $matches);

echo &quote;&lt;pre&gt;&quote;;
print_r($matches);
echo &quote;&lt;/pre&gt;&quote;;
?&gt;



first reading will echo the following code =>
$firstReading = First Reading: <A HREF="http://www.easterbrooks.com/cgi-bin/Bib ... =paragraph" TARGET="_new">Genesis 41:55-57; 42:5-7, 17-24</A><BR>

My results of the print_r($matches) is => echo $firstReading = htmlspecialchars($line);
}
$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
preg_match_all($pattern, $firstReading, $matches);

echo &quote;&lt;pre&gt;&quote;;
print_r($matches);
echo &quote;&lt;/pre&gt;&quote;;
?&gt;



first reading will echo the following code =>
$firstReading = First Reading: <A HREF="http://www.easterbrooks.com/cgi-bin/Bib ... =paragraph" TARGET="_new">Genesis 41:55-57; 42:5-7, 17-24</A><BR>

My results o {
if($line_num == 55)
echo $firstReading = htmlspecialchars($line);
}
$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
preg_match_all($pattern, $firstReading, $matches);

echo "<pre>";
print_r($matches);
echo "</pre>";
?>



first reading will echo the following code =>
$firstReading = First Reading: <A HREF="http://www.easterbrooks.com/cgi-bin/Bib ... 7%3B4lines = file('http://www.easterbrooks.com/cgi-bin/Cat ... i?20050706');

foreach ($lines as $line_num => $line)
{
if($line_num == 55)
echo $firstReading = htmlspecialchars($line);
}
$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
preg_match_all($pattern, $firstReading, $matches);

echo "<pre>";
print_r($matches);
echo "</pre>";
?>



first reading will echo the following code =>
$firstReading = First Reading: <A HREF="http://www.easterbrooks.com/cgi-bin/Bib ... =paragraph" TARGET="_new">Genesis 41:55-57; 42:5-7, 17-24</A><BR>

My results of the print_r($matches) is =>
Array
(
[0] => Array
(
)

[1] => Array
(
)

[2] => Array
(
)

)

what I am trying to do is get all the hyperlinks out of a web page. $firstReading = htmlspecialchars($line);
}
$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
preg_match_all($pattern, $firstReading, $matches);

echo &quote;&lt;pre&gt;&quote;;
print_r($matches);
echo &quote;&lt;/pre&gt;&quote;;
?&gt;



first reading will echo the following code =>
$firstReading = First Reading: <A HREF="http://www.easterbrooks.com/cgi-bin/Bib ... i?20050706');

foreach ($lines as $line_num => $line)
{
if($line_num == 55)
echo $firstReading = htmlspecialchars($line);
}
$pattern = &quote;#&lt;a href=\&quote;(.*?)\&quote;&gt;(.*?)&lt;/a&gt;#i&quote;;
preg_match_all($pattern, $firstReading, $matches);

echo &quote;&lt;pre&gt;&quote;;
print_r($matches);
echo &quote;&lt;/pre&gt;&quote;;
?&gt;



first reading will echo the following code =>
$firstReading = First Reading: <A HREF="http://www.easterbrooks.com/cgi-bin/Bib ... =paragraph" TARGET="_new">Genesis 41:55-57; 42:5-7, 17-24</A><BR>

My results of the print_r($matches) is =>
Array
de

Code: Select all

<?php 
						$lines = file('http://www.easterbrooks.com/cgi-bin/Cathcal.cgi?20050706');
						  
						foreach ($lines as $line_num => $line) 
						{
						 if($line_num == 55)
							echo $firstReading =  htmlspecialchars($line);
						}
						$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
						preg_match_all($pattern, $firstReading, $matches);
							
						echo "<pre>";
						print_r($matches);
						echo "</pre>";
						?>
first reading will echo the following code =>
$firstReading = First Reading: <A HREF="http://www.easterbrooks.com/cgi-bin/Bib ... =paragraph" TARGET="_new">Genesis 41:55-57; 42:5-7, 17-24</A><BR>

My results of the print_r($matches) is =>
Array
(
[0] => Array
(
)

[1] => Array
(
)

[2] => Array
(
)

)

what I am trying to do is get all the hyperlinks out of a web page.
<?php
$lines = file('http://www.easterbrooks.com/cgi-bin/Cat ... i?20050706');

foreach ($lines as $line_num => $line)
{
if($line_num == 55)
echo $firstReading = htmlspecialchars($line);
}
$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
preg_match_all($pattern, $firstReading, $matches);

echo "<pre>";
print_r($matches);
echo "</pre>";
?>



first reading will echo the following code =>
$firstReading = First Reading: <A HREF="http://www.easterbrooks.com/cgi-bin/Bib ... =paragraph" TARGET="_new">Genesis 41:55-57; 42:5-7, 17-24</A><BR>

My results of the print_r($matches) is =>
Array
(
[0] => Array
(
)

[1] => Array
(
)

[2] => Array
(
)

)

what I am trying to do is get all the hyperlinks out of a web page.

Posted: Thu Jul 07, 2005 10:42 am
by Burrito
that's really weird, it works for me:

Code: Select all

$link = "<A HREF=\"http://www.easterbrooks.com/cgi-bin/Bible.cgi?reading=Genesis+41:55-57%3B42:5-7%2C17-24&mode=paragraph\" TARGET=\"_new\">Genesis 41:55-57; 42:5-7, 17-24</A>";
$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
preg_match($pattern,$link,$matches);
echo $matches[1]."<br>".$matches[2];
the above yields:

Code: Select all

http://www.easterbrooks.com/cgi-bin/Bible.cgi?reading=Genesis+41:55-57%3B42:5-7%2C17-24&mode=paragraph" TARGET="_new
Genesis 41:55-57; 42:5-7, 17-24
obviously, you'd need something to strip out the target="..." but let's work on one thing at a time...p;amp;mode=paragraph\" TARGET=\"_new\">Genesis 41:55-57; 42:5-7, 17-24</A>";
$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
preg_match($pattern,$link,$matches);
echo $matches[1]."<br>".$matches[2];


the above yields:

Code: Select all

http://www.easterbrooks.com/cgi-bin/Bible.cgi?reading=Genesis+41:55-57%3B42:5-7%2C17-24&amp;mode=paragraph&quote; TARGET=&quote;_new
Genesis 41:55-57; 42:5-7, 17-24
obviously, you'd need something to strip out the target="..." but let's work on one thing 17-24&mode=paragraph" TARGET="_new
Genesis 41:55-57; 42:5-7, 17-24


obviously, you'd need something to strip out the target="..." but let's work on one thing at a time...
$link = "<A HREF=\"http://www.easterbrooks.com/cgi-bin/Bib ... =paragraph\" TARGET=\"_new\">Genesis 41:55-57; 42:5-7, 17-24</A>";
$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
preg_match($pattern,$link,$matches);
echo $matches[1]."<br>".$matches[2];


the above yields:

Code: Select all

http://www.easterbrooks.com/cgi-bin/Bible.cgi?reading=Genesis+41:55-57%3B42:5-7%2C17-24&amp;mode=paragraph&quote; TARGET=&quote;_new
Genesis 41:55-57; 42:5-7, 17-24
obviously, you'd need something to strip out the target="..." but let's work on one thing at a time...

Posted: Thu Jul 07, 2005 10:46 am
by Chris Corbyn
Ermm... Is it just me or is your loop overwriting $firstReading (which you're matching on) and then all you check is the last line of the file.... hence the blank match.

EDIT | If you do htmlspecialchars() on HTML code too... you'll have no < or > left in the code....

Posted: Thu Jul 07, 2005 10:53 am
by Burrito
d11wtq wrote:EDIT | If you do htmlspecialchars() on HTML code too... you'll have no < or > left in the code....
good catch! wtb d11!

Posted: Thu Jul 07, 2005 10:53 am
by LostOne
Thanks for the help!

Code: Select all

$firstReading =  htmlspecialchars($line);
I took the htmlspecialchars out and it works like a charm!

code is now

Code: Select all

$lines = file('http://www.easterbrooks.com/cgi-bin/Cathcal.cgi?20050706');
						  
						foreach ($lines as $line_num => $line) 
						{
						 if($line_num == 55)
							$firstReading =  $line;
						}
						$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
						preg_match_all($pattern, $firstReading, $matches);
							
						echo "<pre>";
						print_r($matches);
						echo "</pre>";
$lines = file('http://www.easterbrooks.com/cgi-bin/Cat ... i?20050706');

foreach ($lines as $line_num => $line)
{
if($line_num == 55)
$firstReading = $line;
}
$pattern = "#<a href=\"(.*?)\">(.*?)</a>#i";
preg_match_all($pattern, $firstReading, $matches);

echo "<pre>";
print_r($matches);
echo "</pre>";

Posted: Thu Jul 07, 2005 2:14 pm
by Todd_Z

Code: Select all

$pattern = "#<a href=\"([^\"]*)\"[^>]*>(.*?)</a>#i";
Don't worry bout those targets, etc, cuz this will run til it gets to a " and then anything after the href will be ignored.