【发布时间】:2013-05-25 08:03:31
【问题描述】:
这是我的网站:
直到最近我的推文显示正常,但现在我在控制台中收到此错误:
XMLHttpRequest 无法加载 http://www.incomebrokers.com/js/get_tweets.php。起源 http://incomebrokers.com 不允许 访问控制允许来源。
我不知道为什么它刚刚停止工作...谁能帮帮我?
这是我的get_tweets.php 脚本:
session_start();
require_once('twitteroauth/twitteroauth/twitteroauth.php');
$twitteruser = "xxxxxxx";
$notweets = 30;
$consumerkey="xxxxxxxxxx";
$consumersecret="xxxxxxxxxxxxxxx";
$accesstoken="xxxxxxxxxxxxxxxxxxxxx";
$accesstokensecret="xxxxxxxxxxxxxxxxxxxxxxxxxx";
function getConnectionWithAccessToken($cons_key, $cons_secret, $oauth_token, $oauth_token_secret){
$connection = new TwitterOAuth($cons_key, $cons_secret, $oauth_token, $oauth_token_secret);
return $connection;
}
$connection = getConnectionWithAccessToken($consumerkey, $consumersecret, $accesstoken, $accesstokensecret);
$tweets = $connection->get("https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=".$twitteruser."&count=".$notweets);
echo json_encode($tweets);
【问题讨论】:
标签: php xmlhttprequest accesscontrolexception