<?php
/**
* Usage:
* Send the url you want to access url encoded in the url paramater, for example (This is with JS):
* /twitter-proxy.php?url='+encodeURIComponent('statuses/user_timeline.json?screen_name=MikeRogers0&count=2')
*/
// The tokens, keys and secrets from the app you created at https://dev.twitter.com/apps
$config = array(
'oauth_access_token' => '',
'oauth_access_token_secret' => '',
'consumer_key' => '',
'consumer_secret' => '',
'use_whitelist' => false, // If you want to only allow some requests to use this script.
'base_url' => 'http://api.twitter.com/1.1/'
);
/*
* Ok, no more config should really be needed. Yay!
*/
// We'll get the URL from $_GET[]. Make sure the url is url encoded, for example encodeURIComponent('statuses/user_timeline.json?screen_name=MikeRogers0&count=10&include_rts=false&exclude_replies=true')
if(!isset($_GET['url'])){
die('No URL set');
}
$url = $_GET['url'];
if($config['use_whitelist'] && !isset($whitelist[$url])){
die('URL is not authorised');
}
// Figure out the URL parmaters
$url_parts = parse_url($url);
parse_str($url_parts['query'], $url_arguments);
$full_url = $config['base_url'].$url; // Url with the query on it.
$base_url = $config['base_url'].$url_parts['path']; // Url with the query.
/**
* Code below from http://stackoverflow.com/questions/12916539/simplest-php-example-retrieving-user-timeline-with-twitter-api-version-1-1 by Rivers
* with a few modfications by Mike Rogers to support variables in the URL nicely
*/
function buildBaseString($baseURI, $method, $params) {
$r = array();
ksort($params);
foreach($params as $key=>$value){
$r[] = "$key=" . rawurlencode($value);
}
return $method."&" . rawurlencode($baseURI) . '&' . rawurlencode(implode('&', $r));
}
function buildAuthorizationHeader($oauth) {
$r = 'Authorization: OAuth ';
$values = array();
foreach($oauth as $key=>$value)
$values[] = "$key=\"" . rawurlencode($value) . "\"";
$r .= implode(', ', $values);
return $r;
}
// Set up the oauth Authorization array
$oauth = array(
'oauth_consumer_key' => $config['consumer_key'],
'oauth_nonce' => time(),
'oauth_signature_method' => 'HMAC-SHA1',
'oauth_token' => $config['oauth_access_token'],
'oauth_timestamp' => time(),
'oauth_version' => '1.0'
);
$base_info = buildBaseString($base_url, 'GET', array_merge($oauth, $url_arguments));
$composite_key = rawurlencode($config['consumer_secret']) . '&' . rawurlencode($config['oauth_access_token_secret']);
$oauth_signature = base64_encode(hash_hmac('sha1', $base_info, $composite_key, true));
$oauth['oauth_signature'] = $oauth_signature;
// Make Requests
$header = array(
buildAuthorizationHeader($oauth),
'Expect:'
);
$options = array(
CURLOPT_HTTPHEADER => $header,
//CURLOPT_POSTFIELDS => $postfields,
CURLOPT_HEADER => false,
CURLOPT_URL => $full_url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER => false
);
$feed = curl_init();
curl_setopt_array($feed, $options);
$result = curl_exec($feed);
$info = curl_getinfo($feed);
curl_close($feed);
// Send suitable headers to the end user.
if(isset($info['content_type']) && isset($info['size_download'])){
header('Content-Type: '.$info['content_type']);
header('Content-Length: '.$info['size_download']);
}
echo($result);
?>
没有合适的资源?快使用搜索试试~ 我知道了~
商务咨询公司HTML5模板是一款自适应模板,价目表等!_html网站模板_网页源码移动端前端_H5模板_自适应响应式源码.rar
共370个文件
png:125个
jpg:111个
css:60个
0 下载量 100 浏览量
2023-08-05
11:24:14
上传
评论
收藏 3.34MB RAR 举报
温馨提示
商务咨询公司HTML5模板是一款自适应模板,价目表等!_html网站模板_网页源码移动端前端_H5模板_自适应响应式源码.rar
资源推荐
资源详情
资源评论
收起资源包目录
商务咨询公司HTML5模板是一款自适应模板,价目表等!_html网站模板_网页源码移动端前端_H5模板_自适应响应式源码.rar (370个子文件)
style.css 89KB
font-awesome-ie7.min.css 37KB
font-awesome.min.css 21KB
prettyPhoto.css 19KB
revolution-slider.css 13KB
layer-slider.css 13KB
responsive.css 8KB
jquery-ui-1.9.2.custom.css 7KB
bright-brown.css 5KB
pale-orange.css 5KB
dark-blue-color.css 5KB
blue-color.css 5KB
pale-red.css 5KB
moderate-green.css 5KB
strong-orange-color.css 5KB
dark-grey-color.css 5KB
bright-orange.css 5KB
soft-blue-color.css 5KB
light-cyan-color.css 5KB
vivid-cyan-color.css 5KB
strong-brown-color.css 5KB
bright-green.css 5KB
soft-violet-color.css 5KB
soft-pink-color.css 5KB
dark-purple-color.css 5KB
light-blue-color.css 5KB
soft-cyan.css 5KB
vivid-pink-color.css 5KB
vivid-red-color.css 5KB
moderate-violet.css 5KB
soft-red-color.css 5KB
very-dark-blue.css 5KB
dark-cyan.css 5KB
light-green-color.css 5KB
vivid-orange.css 5KB
desaturated-fark-blue.css 5KB
strong-green-color.css 5KB
soft-orange-color.css 5KB
bright-pink.css 5KB
strong-red-color.css 5KB
strong-yellow-color.css 5KB
strong-cyan.css 5KB
bright-red-color.css 5KB
light-orange-color.css 5KB
light-brown-color.css 5KB
light-yellow-color.css 5KB
strong-cyan-color.css 5KB
soft-blue-color-2.css 5KB
skin.css 4KB
skin.css 4KB
skin.css 4KB
skin.css 4KB
skin.css 4KB
skin.css 3KB
skin.css 3KB
jquery.nouislider.min.css 3KB
flexslider.css 3KB
skin.css 3KB
skin.css 1KB
skin.css 537B
fontawesome-webfont.eot 37KB
loader.gif 6KB
loader2.gif 3KB
loader.gif 2KB
loader.gif 2KB
loader.gif 2KB
loader.gif 2KB
loader.gif 2KB
loader.gif 2KB
favicon.gif 877B
loading.gif 771B
default_thumbnail.gif 227B
default_thumbnail.gif 227B
default_thumbnail.gif 227B
default_thumbnail.gif 227B
default_thumbnail.gif 227B
icons.html 42KB
elements.html 41KB
shop-layout.html 34KB
pricing-tables.html 28KB
home-alternative-header-1.html 28KB
home-alternative-header-2.html 27KB
index.html 27KB
blog-post.html 27KB
home-alternative-header-3.html 27KB
home-revolution-slider.html 25KB
home-flex-slider.html 24KB
about-us.html 24KB
blog-small.html 22KB
blog-medium.html 22KB
single-project-small.html 21KB
single-project-large.html 21KB
portfolio-4.html 21KB
blog-large.html 20KB
faq.html 20KB
right-sidebar.html 20KB
left-sidebar.html 20KB
portfolio-3.html 19KB
portfolio-2.html 17KB
clients.html 17KB
共 370 条
- 1
- 2
- 3
- 4
资源评论
supeerzdj
- 粉丝: 11
- 资源: 6184
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功