# Facebook sharer

**URL:** <https://forum.kirupa.com/t/facebook-sharer/322779>\
**Category:** programming\
**Created:** [June 2, 2011, 8:08pm UTC](https://forum.kirupa.com/t/facebook-sharer/322779 "2011-06-02T20:08:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![daniel\_mihalcea](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@daniel\_mihalcea](https://forum.kirupa.com/u/daniel_mihalcea)\
**Post date:** [June 2, 2011, 8:08pm UTC](https://forum.kirupa.com/t/facebook-sharer/322779/1 "2011-06-02T20:08:30Z")

</div>

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.

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.

Here is what i have so far.

```php

<?php

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

";                
            }
         } 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>

```

Can anyone help me?

Thank you.
