-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathfb-cookies-to-get-access-token.php
42 lines (41 loc) · 1.33 KB
/
fb-cookies-to-get-access-token.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
/*
* Facebook cookies to get access token
*/
$cookie = "here is your fb cookies";
if(isset($cookie)) {
$web = curl('https://m.facebook.com/composer/ocelot/async_loader/?publisher=feed', $cookie);
$token = explode('"', explode('accessToken\":\"',$web)[1])[0];
if(empty($token)){
echo 'cookie die';
} else {
echo $token;
}
} else {
echo "error: 404";
}
function curl($url,$cookie) {
$ch = @curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
$head[] = "Connection: keep-alive";
$head[] = "Keep-Alive: 300";
$head[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7";
$head[] = "Accept-Language: en-us,en;q=0.5";
curl_setopt($ch, CURLOPT_USERAGENT, 'Opera/9.80 (Windows NT 6.0) Presto/2.12.388 Version/12.14');
curl_setopt($ch, CURLOPT_ENCODING, '');
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
curl_setopt($ch, CURLOPT_HTTPHEADER, $head);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Expect:'
));
$page = curl_exec($ch);
curl_close($ch);
return $page;
}
?>