Not completely new to PHP itself, but new to using OOP w/ PHP.
Object instantiation & calling method exist in different file.
index.php has this:
<?php
require_once 'scripts/twitteroauth/oauth_index.php';
?>
oauth_index.php has this:
$twitter = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']);
and the file submitting the tweet, submitMessage.php contains this:
include 'twitteroauth/oauth_index.php';
$message = $_GET['message'];
$time = $_GET['time'];
$status = "#" . $message . $time;
$twitter->updateStatus($status);
$output = $twitter->updateStatus($status);
Have tested:
The form submits successfully & gets to the PHP file. The updateStatus() method works fine if it is used within index.php. However, when I submit the form, it is passed to a js function, which passes the variables to the submitMessage.php, and then responds with all the text after $twitter->. It responds “updateStatus($status);$output = $twitter->updateStatus($status);”
Any ideas as to what I’m doing wrong? Thanks for any help.
entirety of sendMessage.php
<?
include 'twitteroauth/oauth_index.php';
$message = $_GET['message'];
$time = $_GET['time'];
$status = "#" . $message . $time;
$output = $twitter->updateStatus($status);
$twitterReturn = new SimpleXMLElement($output);
echo $output;
?>
You need to echo the
$output;