Mercurial > hg > ywww
comparison facebook/postToWall.php @ 6:077b0a0a3e6d
remaining originals according to dependency walk
author | Robert Boland <robert@markup.co.uk> |
---|---|
date | Thu, 16 Feb 2017 22:29:02 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
5:55445b456ad0 | 6:077b0a0a3e6d |
---|---|
1 <?PHP | |
2 $msgOrig = strval($_GET['msg']); | |
3 $msg = stripslashes(urldecode($msgOrig)); | |
4 $linkOrig = strval($_GET['link']); | |
5 $link = stripslashes(urldecode($linkOrig)); | |
6 $imgOrig = strval($_GET['img']); | |
7 $img = stripslashes(urldecode($imgOrig)); | |
8 $titleOrig = strval($_GET['title']); | |
9 $title = stripslashes(urldecode($titleOrig)); | |
10 $authorOrig = strval($_GET['author']); | |
11 $author = stripslashes(urldecode($authorOrig)); | |
12 $reviewOrig = strval($_GET['review']); | |
13 $review = stripslashes(urldecode($reviewOrig)); | |
14 | |
15 | |
16 include_once 'facebook.php'; | |
17 $facebook = new Facebook(array( | |
18 'appId' => '128245333876633', | |
19 'secret' => 'f51afc7e04289db62448edd8b70d83bf', | |
20 'cookie' => true, | |
21 'domain' => 'yournextread.com' | |
22 )); | |
23 | |
24 $session = $facebook->getSession(); | |
25 | |
26 if (!$session) { | |
27 echo "<script type='text/javascript'>top.location.href = 'https://www.facebook.com/login.php?api_key=128245333876633&cancel_url=http%3A%2F%2Fwww.yournextread.com&display=page&fbconnect=1&next=http%3A%2F%2Fwww.yournextread.com%2Ffacebook%2FpostToWall.php%3Flink%3D$linkOrig%26msg%3D$msgOrig%26img%3D$imgOrig%26title%3D$titleOrig%26author%3D$authorOrig%26review%3D$reviewOrig&return_session=1&session_version=3&v=1.0&req_perms=email%2Cpublish_stream%2Cuser_birthday';</script>"; | |
28 } | |
29 else | |
30 { | |
31 try { | |
32 $uid = $facebook->getUser(); | |
33 $me = $facebook->api('/me'); | |
34 //print_r($me); | |
35 $myURL = $me['link']; | |
36 //$actionL = array( "name"=> "See the Book", "link"=> "$link" ); | |
37 //$actionJ = json_encode($actionL); | |
38 | |
39 $facebook->api('/'.$uid.'/feed', 'post', array('message' => "$msg", | |
40 'name' => "$title", | |
41 'caption' => "$author", | |
42 'description' => "$review", | |
43 'picture' => "$img", | |
44 'link' => "$link" | |
45 )); | |
46 //echo $msg ; | |
47 echo "<html> | |
48 <link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\"> | |
49 <body> | |
50 | |
51 <h1>YourNextRead</h1> | |
52 <meta http-equiv=\"refresh\" content=\"2; url=$myURL\"> | |
53 <p>Thank you - your message has been posted</p> | |
54 <p>www.YourNextRead.com</p> | |
55 </body> | |
56 </html>"; | |
57 | |
58 } catch (FacebookApiException $e) { | |
59 echo $e; | |
60 } | |
61 } | |
62 ?> |