Auto like newFeed Facebook | PHP

<?php $token_json ='your token'; $limit = '5'; $token_like ='your token'; $url = "https://graph.facebook.com/me/home?fields=id,from,type,message&limit=$limit&access_token=$token_json"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "$url"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, false); $json = curl_exec($ch); curl_close($ch); $arrjson = json_decode($json,true); $data = $arrjson['data']; for($i=0;$i<count($data);$i++) { $arrid[] = $data[$i]['id']; } $like_count = 0; for($j=0;$j<count($arrid);$j++) { $like = "https://graph.facebook.com/$arrid[$j]/likes?method=POST&access_token=$token_like"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "$like"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, false); $like_re = curl_exec($ch); curl_close($ch); if($like_re == 'true') { $like_count += 1; } unset($like); } echo like Sucess.' '.$like_count.' '.like; ?>

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.