Mercurial > hg > ywww
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/facebook/postToWall.php Thu Feb 16 22:29:02 2017 +0000 @@ -0,0 +1,62 @@ +<?PHP +$msgOrig = strval($_GET['msg']); +$msg = stripslashes(urldecode($msgOrig)); +$linkOrig = strval($_GET['link']); +$link = stripslashes(urldecode($linkOrig)); +$imgOrig = strval($_GET['img']); +$img = stripslashes(urldecode($imgOrig)); +$titleOrig = strval($_GET['title']); +$title = stripslashes(urldecode($titleOrig)); +$authorOrig = strval($_GET['author']); +$author = stripslashes(urldecode($authorOrig)); +$reviewOrig = strval($_GET['review']); +$review = stripslashes(urldecode($reviewOrig)); + + +include_once 'facebook.php'; + $facebook = new Facebook(array( + 'appId' => '128245333876633', + 'secret' => 'f51afc7e04289db62448edd8b70d83bf', + 'cookie' => true, + 'domain' => 'yournextread.com' + )); + + $session = $facebook->getSession(); + + if (!$session) { + 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>"; + } + else + { + try { + $uid = $facebook->getUser(); + $me = $facebook->api('/me'); + //print_r($me); + $myURL = $me['link']; + //$actionL = array( "name"=> "See the Book", "link"=> "$link" ); + //$actionJ = json_encode($actionL); + + $facebook->api('/'.$uid.'/feed', 'post', array('message' => "$msg", + 'name' => "$title", + 'caption' => "$author", + 'description' => "$review", + 'picture' => "$img", + 'link' => "$link" + )); + //echo $msg ; + echo "<html> + <link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\"> + <body> + + <h1>YourNextRead</h1> + <meta http-equiv=\"refresh\" content=\"2; url=$myURL\"> + <p>Thank you - your message has been posted</p> + <p>www.YourNextRead.com</p> + </body> + </html>"; + + } catch (FacebookApiException $e) { + echo $e; + } + } +?>