Jump to content

Need help getting result to appear correctly


elmuchoprez

Recommended Posts

I'm trying to use a script that grabs a piece of data from one site and then prints it on another.  The script is below:

 

<?

$url = 'http://www.iloveyoursite.com/index.php';

$lines_array = file($url);

$lines_string = implode('', $lines_array);

eregi("<html>(.*)</html>", $lines_string, $mydata);

echo $mydata[0];

?>

 

$url = the site your gathering your data from

$mydata = the newly harvested data

<html> and </html> are the first and last items on the $url, you can

replace this with anything. like, if you're wanting their body you may

choose <body> and </body> or anything works...doesn't have to be an

html tag, just a beginning and end. of course these should actually

exist within the $urls page.

 

I would like to set it up so that it displays everything between the <html> tags. Currently however, the reported data includes not only what's between the tags, but the tags themselves.

 

In other words (and I'm sure not the right words), it's including the qualifiers in the results. So if the original code is:

<html>Hello World</html>

 

I want the result to be simply:

Hello World

 

And not:

<html>Hello World</html>

 

I hope that made sense to someone.

 

Anyone know how I can exclude the qualifiers and just print what is between them?

 

Thanks

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.