view facebook/postToWall.php @ 60:05f29eb72283 default tip

review from DB not working???
author Charlie Root
date Sun, 09 Jun 2019 06:50:44 -0400
parents 077b0a0a3e6d
children
line wrap: on
line source

<?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;
                          }
                        }
?>