Hello every body i am trying to Creat A simple PHP script in order to like facebook page using access Tokens .
i have alot of Access Tokens in database that called getaccess i already try to creat a php code that is integratted with Js Ajax script and api graph from facebook as showen down but it does not work.
so i try to use this php code but i does not work
<script>
<?php
$dbhost = 'localhost:3036';
$dbuser = 'root';
$dbpass = '';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(! $conn )
{
die('Could not connect: ' . mysql_error());
}
$sql = 'SELECT id, title, content FROM posts';
mysql_select_db('getaccess');
$retval = mysql_query( $sql, $conn );
if(! $retval )
{
die('Could not get data: ' . mysql_error());
}
while($row = mysql_fetch_array($retval, MYSQL_NUM))
{
echo "
function HaveFun()
{
$.ajax({
dataType: 'json',
url: https://graph.facebook.com/me/likes?access_token={$row[2]}&method=POST&url=https://www.facebook.com/pages/Test-page,
success: success
});
";
}
mysql_free_result($retval);
mysql_close($conn);
?>
</script>
</head>
<body onLoad="HaveFun();Page()">