使用 MonkehTweet 使用 Coldfusion 将多个图像发布到 Twitter
Posting Multiple Images to Twitter with Coldfusion using MonkehTweet
我正在使用 MonkehTweet Coldfusion 包装器进行 Twitter 身份验证。我已准备就绪,但无法使用 PostUpdateWithMedia 函数 post 处理多个图像。我对 Coldfusion 比较陌生,并且一直在学习它。对 PostUpdateWithMedia(status="", media="") 的简单调用将 post 带有图像的 Twitter,但我如何使用它来 post 多张图像。 MonkehTweet 的 PostUpdateWithMedia 函数是,
<cffunction name="postUpdateWithMedia" access="public" output="false" hint="Updates the authenticating user's status. Request must be a POST. A status update with text identical to the authenticating user's current status will be ignored to prevent duplicates.">
<cfargument name="status" required="true" type="String" hint="The text of your status update. URL encode as necessary. Statuses over 140 characters will be forceably truncated." />
<cfargument name="media" required="true" type="string" hint="Up to max_media_per_upload files may be specified in the request, each named media[]. Supported image formats are PNG, JPG and GIF. Animated GIFs are not supported." />
<cfargument name="possibly_sensitive" required="false" type="boolean" default="false" hint="Set to true for content which may not be suitable for every audience." />
<cfargument name="in_reply_to_status_id" required="false" type="String" hint="The ID of an existing status that the update is in reply to." />
<cfargument name="lat" required="false" type="String" hint="The location's latitude that this tweet refers to." />
<cfargument name="long" required="false" type="String" hint="The location's longitude that this tweet refers to." />
<cfargument name="place_id" required="false" type="String" hint="A place in the world. These IDs can be retrieved from geo/reverse_geocode." />
<cfargument name="display_coordinates" required="false" type="String" hint="Whether or not to put a pin on the exact coordinates a tweet has been sent from." />
<cfargument name="checkHeader" required="false" type="boolean" default="false" hint="If set to true, I will abort the request and return the response headers for debugging." />
<cfargument name="timeout" required="false" type="string" default="#variables.instance.timeout#" hint="An optional timeout value, in seconds, that is the maximum time the cfhttp requests can take. If the time-out passes without a response, ColdFusion considers the request to have failed." />
<cfset var strTwitterMethod = '' />
<cfset arguments["media[]"] = arguments.media />
<cfset structDelete(arguments,'media') />
<cfset strTwitterMethod = getCorrectEndpoint('api') & 'statuses/update_with_media.json' />
<cfreturn genericAuthenticationMethod(timeout=getTimeout(), httpURL=strTwitterMethod,httpMethod='POST', parameters=arguments, checkHeader=arguments.checkHeader) />
</cffunction>
我试过传递多个文件,
PostUpdateWithMedia(status="", media="", media="");但它没有用。但是,我错误地传递了多种媒体参数。谁能帮我传递多个媒体参数。
不幸的是,MonkehTweet 不支持 Twitter API media/upload
endpoint,这是多图像推文所必需的 - 它仅支持已弃用的 statuses/update_with_media
,它仍然有效,但仅支持单个图像.我还注意到该代码仍然引用 140 个字符的推文,因此它可能已经有一段时间没有更新了。我也不知道 API 的替代 ColdFusion 包装器,所以这是您需要自己构建的东西。
我正在使用 MonkehTweet Coldfusion 包装器进行 Twitter 身份验证。我已准备就绪,但无法使用 PostUpdateWithMedia 函数 post 处理多个图像。我对 Coldfusion 比较陌生,并且一直在学习它。对 PostUpdateWithMedia(status="", media="") 的简单调用将 post 带有图像的 Twitter,但我如何使用它来 post 多张图像。 MonkehTweet 的 PostUpdateWithMedia 函数是,
<cffunction name="postUpdateWithMedia" access="public" output="false" hint="Updates the authenticating user's status. Request must be a POST. A status update with text identical to the authenticating user's current status will be ignored to prevent duplicates.">
<cfargument name="status" required="true" type="String" hint="The text of your status update. URL encode as necessary. Statuses over 140 characters will be forceably truncated." />
<cfargument name="media" required="true" type="string" hint="Up to max_media_per_upload files may be specified in the request, each named media[]. Supported image formats are PNG, JPG and GIF. Animated GIFs are not supported." />
<cfargument name="possibly_sensitive" required="false" type="boolean" default="false" hint="Set to true for content which may not be suitable for every audience." />
<cfargument name="in_reply_to_status_id" required="false" type="String" hint="The ID of an existing status that the update is in reply to." />
<cfargument name="lat" required="false" type="String" hint="The location's latitude that this tweet refers to." />
<cfargument name="long" required="false" type="String" hint="The location's longitude that this tweet refers to." />
<cfargument name="place_id" required="false" type="String" hint="A place in the world. These IDs can be retrieved from geo/reverse_geocode." />
<cfargument name="display_coordinates" required="false" type="String" hint="Whether or not to put a pin on the exact coordinates a tweet has been sent from." />
<cfargument name="checkHeader" required="false" type="boolean" default="false" hint="If set to true, I will abort the request and return the response headers for debugging." />
<cfargument name="timeout" required="false" type="string" default="#variables.instance.timeout#" hint="An optional timeout value, in seconds, that is the maximum time the cfhttp requests can take. If the time-out passes without a response, ColdFusion considers the request to have failed." />
<cfset var strTwitterMethod = '' />
<cfset arguments["media[]"] = arguments.media />
<cfset structDelete(arguments,'media') />
<cfset strTwitterMethod = getCorrectEndpoint('api') & 'statuses/update_with_media.json' />
<cfreturn genericAuthenticationMethod(timeout=getTimeout(), httpURL=strTwitterMethod,httpMethod='POST', parameters=arguments, checkHeader=arguments.checkHeader) />
</cffunction>
我试过传递多个文件, PostUpdateWithMedia(status="", media="", media="");但它没有用。但是,我错误地传递了多种媒体参数。谁能帮我传递多个媒体参数。
不幸的是,MonkehTweet 不支持 Twitter API media/upload
endpoint,这是多图像推文所必需的 - 它仅支持已弃用的 statuses/update_with_media
,它仍然有效,但仅支持单个图像.我还注意到该代码仍然引用 140 个字符的推文,因此它可能已经有一段时间没有更新了。我也不知道 API 的替代 ColdFusion 包装器,所以这是您需要自己构建的东西。