-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlike.php
59 lines (45 loc) · 1.56 KB
/
like.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<!DOCTYPE html>
<html lang="en">
<head>
<?php
include 'functions.php';
$accessToken = '309165108.d64dad5.0bd360f0dab34b1f9c0e00357ef4d90e';
$clientID = 'd64dad5dbfc34db1b77e33eff6afd7d8';
//$clientSecret = 'da7836e88c7347cfaad25fffdb9b92bf';
$redirectURI = 'http://localhost/instafeed/index.php';
if(isset($_GET['media_id'])){
$media_id = $_GET['media_id'];
$url = "https://api.instagram.com/v1/media/{$media_id}/likes";
$ch = curl_init();
curl_setopt_array($ch, array (
CURLOPT_URL => $url,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => http_build_query($accessToken), //farligt enl. säkerhet?
CURLOPT_RETURNTRANSFER => true
));
curl_exec($ch);
curl_close($ch);
//return $result;
/*
$media_id = $_GET['media_id'];
//return $result;
$url = "https://api.instagram.com/v1/media/".$media_id."/likes";
$fields = array(
'access_token' => '309165108.d64dad5.0bd360f0dab34b1f9c0e00357ef4d90e'
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($fields));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
*/
header("Location: ".$redirectURI);
die();
}
?>
</head>
<body>
</body>
</html>