What is really wrong with my PHP code here ? In need of help

Links for php scripts

Moderators: egami, macek, gesf

Post Reply
phpcoder85
New php-forum User
New php-forum User
Posts: 13
Joined: Sun Dec 04, 2011 10:43 am

Sun Dec 04, 2011 5:13 pm

Ok the PHP code below generates this error , I am totally confused ... The error warning is the following :
Parse error: syntax error, unexpected $end on line 85 ...85 is at the very bottom , My thought was that there is a missing curly bracket, but I can't seem to find it . Your help would be SO MUCH appreciated !!!!

The code is below :


<?php
include "twitter-async/EpiCurl.php";
include "twitter-async/EpiOAuth.php";
include "twitter-async/EpiTwitter.php";
define("TWITTER_CONSUMER_KEY","c7MyJzMMzHEKqknBlSVDA");
define("TWITTER_CONSUMER_SECRET","zwAtk4CRyUHz9USVAT41fA8SJbnIOhHHR1vJGaHCMU");
define("INDEX","first.php");
define("MASTER","master.php");
define("TITLE","test Tube - Sign In with Twitter");
function init($oauth_token= null, $oauth_token_secret= null){
return new EpiTwitter(TWITTER_CONSUMER_KEY,TWITTER_CONSUMER_SECRET,$oauth_token,$oauth_token_secret);
}
function logout(){
$twitter = init($_COOKIE["oauth_token"], $_COOKIE["oauth_token_secret"]);
$twitter->post_accountEnd_session();
setcookie("oauth_token","",1);
setcookie("oauth_token_secret","",1);
header("Location: ".INDEX."?loggedout");
}
function login(){
//An Oauth Token has just been granted from Twitter
if(!empty($_GET["oauth_token"])){
$twitter = init();
$oauth_token = $_GET["oauth_token"];
try{
$twitter->setToken($oauth_token);
$token= $twitter->getAccessToken();
$twitter->setToken($token->oauth_token,$token->ouath_token_secret);
setcookie("oauth_token",$token->oauth_token);
setcookie("oauth_token_secret",$token->oauth_token_secret);
header("Location: ".MASTER."?loggedin");
}
catch(EpiOauthException $e) {header("Location:".INDEX."?oauthexception");}
catch(EpiTwitterException $e) {header("Location: ".INDEX."?exception");
}
} else if(
empty($_COOKIE["oauth_token"]) && empty($_COOKIE["oauth_token_secret"]))
{
setcookie("oauth_token","",1);
setcookie("oauth_token_secret","",1);
header("Location: ".INDEX);
} else{
return init($_COOKIE["oauth_token"],$_COOKIE["oauth_token_secret"]);
}
}
function verify($twitter){
if(is_object($twitter)) {
$response = $twitter->get_accountVerify_credentials();
return check($response);
} else{
return false;
}
function check($payload){
return ($payload->code == 200) ? $payload: false;
}

function printFriends($twitterObj, $count = 10) {
try {
$friends = $twitterObj->get_statusesFriends(array("cursor" => -1));
if (check($friends)) {
$next_cursor = $friends->next_cursor;
$previous_cursor = $friends->previous_cursor;
echo "<h2>Latest ".$count." Twitter Friends</h2>";
for ($i = 0; $i < $count; $i++) {
$friend = $friends->users[$i];
echo '<span><a title=\"'.$friend->name.'\" href="http://twitter.com/\"'.
$friend->screen_name.'\"><img class="following" src=\"'.$friend->
profile_image_url.'\" alt=\"'.$friend->screen_name.'\" height="48"
width="48" /></a></span>';
}
} else {
return false;
}
}


catch(EpiTwitterException $e) {echo "<p> You have no friends to list .</p>";}
}



?>

kc0pph
New php-forum User
New php-forum User
Posts: 86
Joined: Sat Nov 26, 2011 8:39 am
Location: Pueblo, CO
Contact:

Sun Dec 04, 2011 5:18 pm

posting the same thing a second time can be considered SPAM!!!!


SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM v SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM :offtopic: :offtopic: :offtopic:

FollowTheTortoise
New php-forum User
New php-forum User
Posts: 80
Joined: Sun Dec 04, 2011 1:35 pm
Location: Southern California
Contact:

Wed Dec 07, 2011 10:05 pm

kc0pph wrote:posting the same thing a second time can be considered SPAM!!!!

SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM v SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM :offtopic: :offtopic: :offtopic:
I'm off topic here, but you declare a dual post spam, yet say nothing about the various other very obvious SPAM post in this forum?

Anywho..... OP, you were just missing a curly bracket near the middle somewhere...

Code: Select all

<?php

include "twitter-async/EpiCurl.php";
include "twitter-async/EpiOAuth.php";
include "twitter-async/EpiTwitter.php";
define("TWITTER_CONSUMER_KEY", "c7MyJzMMzHEKqknBlSVDA");
define("TWITTER_CONSUMER_SECRET", "zwAtk4CRyUHz9USVAT41fA8SJbnIOhHHR1vJGaHCMU");
define("INDEX", "first.php");
define("MASTER", "master.php");
define("TITLE", "test Tube - Sign In with Twitter");

function init($oauth_token= null, $oauth_token_secret= null) {
    return new EpiTwitter(TWITTER_CONSUMER_KEY, TWITTER_CONSUMER_SECRET, $oauth_token, $oauth_token_secret);
}

function logout() {
    $twitter = init($_COOKIE["oauth_token"], $_COOKIE["oauth_token_secret"]);
    $twitter->post_accountEnd_session();
    setcookie("oauth_token", "", 1);
    setcookie("oauth_token_secret", "", 1);
    header("Location: " . INDEX . "?loggedout");
}

function login() {
//An Oauth Token has just been granted from Twitter
    if (!empty($_GET["oauth_token"])) {
        $twitter = init();
        $oauth_token = $_GET["oauth_token"];
        try {
            $twitter->setToken($oauth_token);
            $token = $twitter->getAccessToken();
            $twitter->setToken($token->oauth_token, $token->ouath_token_secret);
            setcookie("oauth_token", $token->oauth_token);
            setcookie("oauth_token_secret", $token->oauth_token_secret);
            header("Location: " . MASTER . "?loggedin");
        } catch (EpiOauthException $e) {
            header("Location:" . INDEX . "?oauthexception");
        } catch (EpiTwitterException $e) {
            header("Location: " . INDEX . "?exception");
        }
    } else if (
            empty($_COOKIE["oauth_token"]) && empty($_COOKIE["oauth_token_secret"])) {
        setcookie("oauth_token", "", 1);
        setcookie("oauth_token_secret", "", 1);
        header("Location: " . INDEX);
    } else {
        return init($_COOKIE["oauth_token"], $_COOKIE["oauth_token_secret"]);
    }
}

function verify($twitter) {
    if (is_object($twitter)) {
        $response = $twitter->get_accountVerify_credentials();
        return check($response);
    } else {
        return false;
    }
}

function check($payload) {
    return ($payload->code == 200) ? $payload : false;
}

function printFriends($twitterObj, $count = 10) {
    try {
        $friends = $twitterObj->get_statusesFriends(array("cursor" => -1));
        if (check($friends)) {
            $next_cursor = $friends->next_cursor;
            $previous_cursor = $friends->previous_cursor;
            echo "<h2>Latest " . $count . " Twitter Friends</h2>";
            for ($i = 0; $i < $count; $i++) {
                $friend = $friends->users[$i];
                echo '<span><a title=\"' . $friend->name . '\" href="http://twitter.com/\"' .
                $friend->screen_name . '\"><img class="following" src=\"' . $friend->
                profile_image_url . '\" alt=\"' . $friend->screen_name . '\" height="48"
width="48" /></a></span>';
            }
        } else {
            return false;
        }
    } catch (EpiTwitterException $e) {
        echo "<p> You have no friends to list .</p>";
    }
}

 

Post Reply