elmuchoprez Posted April 26, 2007 Share Posted April 26, 2007 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 Link to comment https://forums.phpfreaks.com/topic/48810-need-help-getting-result-to-appear-correctly/ Share on other sites More sharing options...
suttercain Posted April 26, 2007 Share Posted April 26, 2007 <?php $text = "<html>Hello World</html>"; echo strip_tags($text); //echoes Hello World ?> Link to comment https://forums.phpfreaks.com/topic/48810-need-help-getting-result-to-appear-correctly/#findComment-239215 Share on other sites More sharing options...
per1os Posted April 26, 2007 Share Posted April 26, 2007 www.php.net/strip_tags that might help you out. Link to comment https://forums.phpfreaks.com/topic/48810-need-help-getting-result-to-appear-correctly/#findComment-239218 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.