PDA

View Full Version : Facebook sharer


daniel.mihalcea
06-02-2011, 07:52 PM
Hi there,

I am building a gallery in flash AS2 with swfaddress and swfobject so that i could have links on my gallery and in addition i added a facebook like button so that every page to be posted on facebook.

My problem is that i am trying to send the thumb, description and title of my current page and this is where i got stuck.

Can anyone help me?

Thank you.

daniel.mihalcea
06-02-2011, 07:58 PM
I forgot to add.
I have tried something with a php script where i send all this information and the php to call facebook sharer and to add the post, but i don't know very well php.
This is what i have so far:


<?php

error_reporting(E_ALL);
if ($_SERVER['REQUEST_METHOD']=="POST"){
foreach($_POST as $key => $val){
if (is_array($val)){
$msg.="Item: $key\n";
foreach($val as $v){
$v = stripslashes($v);
$msg.=" $v\n\n";
}
} else {
$val = stripslashes($val);
$cos[$key] = $val;
}
}
}

function curPageURL() {
$pageURL = 'http';
$pageURL .= "://";
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];

return $pageURL;
}

$titlu = $cos['t'];
$descriere = $cos['d'];
$thumb = $cos['thumb'];

$currentURL = curPageURL();
$url = "http://www.facebook.com/sharer.php?u=$currentURL";

echo "$url";
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<title><?php echo $titlu ?></title>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="cache-control" content="no-cache" />

<meta http-equiv="pragma" content="no-cache" />
<meta name="description" content="<?php echo $descriere ?>" >

<link rel="image_src" href="<?php echo "$thumb" ?>" />

<style type="text/css">
h {
font-family: Arial, Helvetica, sans-serif;
}
</style>

</head>

<body>

<a target="_blank" href="<?php $url?>" >
Share this on Facebook
</a>
<div>
<img src="<?php echo "$thumb" ?>" width="120" height="90" alt="alt" />
</div>


<div>
<p><?php echo $titlu ?></p>
<p><?php echo $descriere ?></p>
</div>

</body>
</html>