<code>array (size=7)
'raw' => string '' (length=0)
'headers' =>
array (size=22)
'HTTP/1.1 401 Unauthorized' => string '' (length=0)
'cache-control' => string 'no-cache, no-store, must-revalidate, pre-check=0, post-check=0' (length=62)
'content-encoding' => string 'gzip' (length=4)
'content-length' => string '41' (length=2)
'content-type' => string 'text/html; charset=utf-8' (length=24)
'date' => string 'Sun, 15 Jun 2014 16:48:05 GMT' (length=29)
'expires' => string 'Tue, 31 Mar 1981 05:00:00 GMT' (length=29)
'last-modified' => string 'Sun, 15 Jun 2014 16:48:05 GMT' (length=29)
'pragma' => string 'no-cache' (length=8)
'server' => string 'tfe' (length=3)
'set-cookie' =>
array (size=2)
0 => string '_twitter_sess=BAh7BzoPY3JlYXRlZF9hdGwrCFa%252FbaBGAToHaWQiJTllNmNlMGUzMGJiYjJl%250AODJjNmE5NDIzN2Y4NTc1ZTI2--7841cbe45707fc68c30ba566c184d6e6344b7226; domain=.twitter.com; path=/; secure; HttpOnly' (length=196)
1 => string 'guest_id=v1%3A140285088532045126; Domain=.twitter.com; Path=/; Expires=Tue, 14-Jun-2016 16:48:05 UTC' (length=100)
'status' => string '401 Unauthorized' (length=16)
'strict-transport-security' => string 'max-age=631138519' (length=17)
'vary' => string 'Accept-Encoding' (length=15)
'x-content-type-options' => string 'nosniff' (length=7)
'x-frame-options' => string 'SAMEORIGIN' (length=10)
'x-mid' => string 'b41b68c3d8a9b195e0aca9faf30067dd1d464be6' (length=40)
'x-runtime' => string '0.00959' (length=7)
'x-transaction' => string '55a9e48507f88490' (length=16)
'x-ua-compatible' => string 'IE=edge,chrome=1' (length=16)
'x-xss-protection' => string '1; mode=block' (length=13)
'' => string '' (length=0)
'code' => int 0
'response' => boolean false
'info' =>
array (size=26)
'url' => string 'https://api.twitter.com/1.1/statuses/update_with_media.json' (length=59)
'content_type' => null
'http_code' => int 0
'header_size' => int 0
'request_size' => int 0
'filetime' => int -1
'ssl_verify_result' => int 20
'redirect_count' => int 0
'total_time' => float 0.453
'namelookup_time' => float 0
'connect_time' => float 0.156
'pretransfer_time' => float 0
'size_upload' => float 0
'size_download' => float 0
'speed_download' => float 0
'speed_upload' => float 0
'download_content_length' => float -1
'upload_content_length' => float -1
'starttransfer_time' => float 0
'redirect_time' => float 0
'certinfo' =>
array (size=0)
empty
'primary_ip' => string '199.16.156.104' (length=14)
'primary_port' => int 443
'local_ip' => string '192.168.0.103' (length=13)
'local_port' => int 58021
'redirect_url' => string '' (length=0)
'error' => string 'couldn't open file "./"' (length=23)
'errno' => int 26
<?php
require 'config.php';
require 'tmhOAuth.php';
require 'tmhUtilities.php';
/// retrive temp access token from cookie
$token = $_COOKIE['Temp_Token'];
$secret = $_COOKIE['Temp_Secret'];
$img = $_COOKIE['Img_Url'];
$txt = $_COOKIE['Tweet_Txt'];
$tmhOAuth = new tmhOAuth(array(
'consumer_key' => API_KEY,
'consumer_secret' => API_SEC,
'user_token' => $token,
'user_secret' => $secret,
'curl_ssl_verifypeer' => false
));
/// Ask Twitter for correct access token
$tmhOAuth->request("POST", $tmhOAuth->url("oauth/access_token", ""), array(
// pass the oauth_verifier received from Twitter
'oauth_verifier' => $_GET["oauth_verifier"]
));
$response = $tmhOAuth->extract_params($tmhOAuth->response["response"]);
$tmhOAuth->config["user_token"] = $response['oauth_token'];
$tmhOAuth->config["user_secret"] = $response['oauth_token_secret'];
$img = './'.$img;
$code = $tmhOAuth->request('POST', 'https://api.twitter.com/1.1/statuses/update_with_media.json',
array(
'media[]' => "@{$img}",
'status' => "$txt" // Don't give up..
),
true, // use auth
true // multipart
);
var_dump($tmhOAuth->response);
if ($code == 200){
// tmhUtilities::pr(json_decode($tmhOAuth->response['response']));
echo '<h1>Your image tweet has been sent successfully</h1>';
}else{
// display the error
tmhUtilities::pr($tmhOAuth->response['response']);
return tmhUtilities;
}
?>
<php>
这个APIendpoint现在已经被否决了。
我在Twitter API上工作,为用户创建一个功能,可以直接从软件发推:以下是我的代码: 脚本运行良好(不会抛出任何错误/异常),但它不是上传文件,而是简单地推送媒体ID。 我应该如何更改它,以便它上传带有状态消息的媒体文件。
我尝试用java GraphQL上传文件。我研究了这个主题的解决方案:如何用GraphQL-Java上传文件?我使用的是graphql-java版本11.0、graphql-spring-boot-starter版本5.0.2、graphql-java-kickstart版本7.5.0。 我做错了什么?
如何使用java将图像上传到wordpress API?restapi的路径是wp-json/wp/v2/media
为了排除可能的其他问题,我可以使用update.json方法成功地将状态更新发布到Twitter。 我还尝试使用client.addfile方法和Fiddler,看起来一切都就绪了。但我不断得到的错误信息是
我正在构建一个小系统,允许用户登录到该系统,进行查询并检索与查询“相关”的推文。我还想获得用户过去的推文、他的followee/er ID和个人资料信息。 所以这个推特api页面说, 为了对Twitter的API进行授权调用,您的应用程序必须首先代表Twitter用户获取OAuth访问令牌,或者您可以在不需要用户上下文时发出仅限应用程序的身份验证请求 因此,在我的应用程序中,如果我要使用Twitt
请求方式: 使用multipart/form-data POST上传文件 请求地址: https://open.qingtui.cn/v1/media/upload?access_token=ACCESS_TOKEN&type=TYPE 请求示例(使用curl命令,用FORM表单方式上传一个多媒体文件): curl -F media=@test.jpg "https://open.qingtui.