通过终端运行twitter php脚本

通过终端运行twitter php脚本,php,twitter,terminal,Php,Twitter,Terminal,我试图访问twitter帐户的信息,但我一直遇到以下错误: 解析错误:解析错误,第33行的/Users/thegreenfrog/Desktop/twitter/tweet.php中应为“`” 我似乎看不出有什么问题,所以我希望其他人也看到了 谢谢 <?php // Load the app's OAuth tokens into memory require 'app_tokens.php'; // Load the tmhOAuth library require 'tmhOAut

我试图访问twitter帐户的信息,但我一直遇到以下错误: 解析错误:解析错误,第33行的/Users/thegreenfrog/Desktop/twitter/tweet.php中应为“`”

我似乎看不出有什么问题,所以我希望其他人也看到了

谢谢

<?php

// Load the app's OAuth tokens into memory
require 'app_tokens.php';

// Load the tmhOAuth library
require 'tmhOAuth.php';

// Create an OAuth connection to the Twitter API
$connection = new tmhOAuth(array(
  'consumer_key'    => $consumer_key,
  'consumer_secret' => $consumer_secret,
  'user_token'      => $user_token,
  'user_secret'     => $user_secret
));

// Send a tweet
// $code = $connection->request('POST',$connection->url('1.1/statuses/update'), array('status' => 'Hello Twitter'));
// // A response code of 200 is a success
//
// if ($code == 200) { 
// print "Tweet sent";
// }

// else{
// print "Error: $code";
// }

//Get @justinbieber's account info
$connection->request('GET', $connection->url('1.1/users/show'), array('screen_name' => 'justinbieber’));
//Get the HTTP response code for the API request 

$response_code = $connection->response['code'];
// Convert the JSON response into an array
$response_data = json_decode($connection->response['response'],true);
// A response code of 200 is a success 

if ($response_code <> 200) {
print "Error: $response_code\n"; }
// Display the response array 
print_r($response_data);
?>
老兄

你用错了引号

'justinbieber’));
也是错误的艺术家。哈哈,开玩笑

替换为:

$connection->request('GET', $connection->url('1.1/users/show'), array('screen_name' => 'justinbieber'));

投艺术家的票。哦,当然还有答案:PShorter答案:不要用微软Word写代码。哈哈,是的,我知道。这只是为了测试。谢谢你!成功了。