I want to add rss to my site that checks information about the url the user has posted then returns the image from the site, and brief describtion of what the site does.....just like the way facebook does it when user posts a url. Any ideas how it's done or a link to a tutorial would help...

use fread if you can but make a stylesheet up for page too. beware as some websites will not let you do this as a check gets done for "in iframe'


this is one way:

<html>
<head>
<style>
<!-- i used this for an example, you can create your own stylesheet and add it to this page, styled the way you want -->
a{
float:right; }
</style><div><!-- Start of FORM -->
<form style="text-align:center;" method="post" action="">
<input type="text" name="url" value="http://"><input type="submit" name="submit" value="submit">
</form>
</div><?php
$url = $_REQUEST;
$file = fopen("$url", "r");
//Output a line of the file until the end is reached
while(!feof($file))
{
echo fgets($file);
echo fgetc($file);
}
fclose($file);
?>

Thanx a lot, I've just tried it out and it works....one last quetion, is it possible to get innerHTM values like metadata using php?

I also Found this and it works

<?php

/*
** Extracts and formats meta tag content
*/

function get_meta_data($url, $searchkey='') {
$data = get_meta_tags($url); // get the meta data in an array
foreach($data as $key => $value) {
if(mb_detect_encoding($value, 'UTF-8, ISO-8859-1', true) != 'ISO-8859-1') { // check whether the content is UTF-8 or ISO-8859-1
$value = utf8_decode($value); // if UTF-8 decode it
}
//$value = strtr($value, get_html_translation_table(HTML_ENTITIES)); // mask the content
if(!empty($searchkey)) { // if only one meta tag is in demand e.g. 'description'
if(in_array($key,$searchkey)) {
$str .= $value."<br/>"; // just return the value
}
} else { // all meta tags
$pattern = '/ ¦,/i'; // ' ' or ','
$array = preg_split($pattern, $value, -1, PREG_SPLIT_NO_EMPTY); // split it in an array, so we have the count of words
$str .= '<p><span style="display:block;color:#000000;font-weight:bold;">' . $key . ' <span style="font-weight:normal;">(' . count($array) . ' words ¦ ' . strlen($value) . ' chars)</span></span>' . $value . '</p>'; // format data with count of words and chars
}
}
return $str;
}

$searchkey = array("description");
$content .= get_meta_data("http://www.amazon.com/",$searchkey);
echo $content;
?>

The easiest answer is its already in the fread statement we performed earlier.

but yes it is possible in a simple way by doing this, using css.

do this:
<html>
<head>
<style>
<!-- i used this for an example, you can create your own stylesheet and add it to this page, styled the way you want -->

a{
float:right; }
#styled{
color: orange;
background-color: black;
float: right;
/* you can change the width to pixels if you want, just did it to view the two side by side */
width: 50%;
/* The border is here */
border:ridge black 45px;
padding: 15px;
/*comment the following line to un-justify the text */
text-align:justify;
}
#styled h3
{
color:red;
text-transform:uppercase;
}
#styled p
{
color:white;
}
</style></head><body>

<?php
$tags = get_meta_tags('http://something.com');
// You can declare tags as a variable if you wish
$varName = $tags;
echo "<div id='styled'><h3>varName which was 'keywords' styled with css:</h3><p>$varName</p> this is the default color for #styled. check the style statement, change it to what ever you want<h4>Don't you just love php? If you like this, please up vote my profile on Daniweb. I hope this helps.</h4></div>";
echo "THIS IS THE ECHO STATEMENT WITH varName which was 'keywords':<br /><br /> $varName";
echo "Keywords:".$tags."<br /><br /><br /><br />";
echo "Description:".$tags."<br /><br /><br /><br />";
?>

Hope this helps, upload it to your server to view the styling.

Please remember to mark this post as solved if it has been solved .

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.