简体   繁体   English

使用Java脚本上传Twitter图片。

[英]Twitter image upload using java script.

I am trying to upload a image to twitter via https://api.twitter.com/1.1/statuses/update_with_media.json API provided by twitter. 我正在尝试通过twitter提供的https://api.twitter.com/1.1/statuses/update_with_media.json API将图像上传到twitter。

I am really confused about the flow for calling this API. 我真的对调用此API的流程感到困惑。 How will I get user authenticate and allow my application to post data ? 如何获得用户身份验证并允许我的应用程序发布数据? Can anyone give me the exact steps to follow for implementing this ? 谁能给我确切的步骤以执行此操作? If any one having sample code for the same that will be most helpful. 如果有人有相同的示例代码,那将是最有帮助的。

If there is any library available for then please direct me to it. 如果有任何可用的库,请直接引导我到它。

Regards 问候

Are you trying to do this from javascript client code? 您是否要通过javascript客户端代码执行此操作? I had to do that recently, and you're going to have to user server-side code, for two reasons: 我最近不得不这样做,由于两个原因,您将不得不使用用户服务器端代码:

  1. You may have to store tokens in your client code. 您可能必须在客户代码中存储令牌。 Which would be a security hole. 这将是一个安全漏洞。
  2. Twitter API no longer allows cross-browser requests, as their responses don't include 'access-control-allow-origin' headers, so you won't be able to call them via AJAX. Twitter API不再允许跨浏览器请求,因为它们的响应不包括“ access-control-allow-origin”标头,因此您将无法通过AJAX对其进行调用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Java脚本的新功能。 如何使用应用程序脚本将我的VBA自定义函数转换为在工作表中工作 - New to java script. How to convert my vba custom function to work in sheets using app scriptor 如何使用html和Java脚本在Windows Azure移动服务中存储文件(恢复)? - How to Store file (Resume) in windows azure mobile service using html and java script.? 使用Java脚本在Google Maps v3上无法进行标记拖动。 怎么做? - Marker dragging doesn't work on google maps v3 using java script. How to do it? 使用Java脚本导出html表excel。 找到“#”字样时不导出 - Exporting html table excel using java script. not exporting when it find '#' chracter Twitter API - 上传图片 - Twitter API - upload an image Twitter-使用upload.json上传图像时出现媒体错误 - Twitter - media error while uploading image using upload.json CSS Twitter Bootstrap覆盖JavaScript样式,因为它在脚本之后执行。 最后如何执行脚本? - CSS Twitter Bootstrap overrides JavaScript style because it executes after script. How to execute script last? Java脚本。 如何选择数组的任何几项 - Java Script. How to choose any few items of array Java脚本中的游戏。 我应该使用帆布吗? - A game in java script. Should I use canvas? 无法找到元素。 我正在使用量角器Java脚本。 我有几种方法,如CSS,xpath和id - Unable to locate element. I am using protractor java script. I have several methods like css, xpath and id
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM