推特网址编码 [英] Twitter URL encoding

查看:46
本文介绍了推特网址编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们即将推出一个小小的 twitter 圣诞节竞赛,我遇到了一个小问题.

We're about to launch a little twitter Christmas competition, and I've run into a little snag.

要进入,人们需要以以下格式发布推文:

To enter, people will need to post a tweet in the following format:

@user blah, blah, blah #hashtag

目前,我有一个表格,他们可以在其中输入他们的答案(等等,等等,等等)和一个 PHP 脚本,该脚本对整个语句进行编码并添加到 twitter 网址上:

Currently, I have a form where they enter their answer (the blah, blah, blah) and a PHP script which encodes the entire statement and adds on the twitter url:

http://www.twitter.com/home?status=%40user%20blah%2Cblah%2Cblah%20%23hashtag

然后将用户带到 Twitter 并将状态放在更新字段中.

Then takes the user to twitter and puts the status in the update field.

然而,虽然空格 (%20) 被很好地解码,@ 和 # 字符仍为 %40 &分别为 %23,即使在发布推文时也是如此.我无法在 url 中输入实际字符,因为 twitter 将其误认为是搜索.

However, whilst the spaces (%20) are decoded fine the @ and # characters remain as %40 & %23 respectively, even when the tweet is posted. I cannot put the actual characters in the url as twitter mistakes this for a search.

有什么办法可以解决这个问题吗?我想这样做而不需要用户名 &如果可能,密码等.

Is there any way to solve this? I'd like to do it without requiring username & password etc if possible.

任何帮助将不胜感激.

推荐答案

将空格编码为 + 即可:http://twitter.com/home?status=%40user+blah%2Cblah%2Cblah+%23hashtag

Encode the spaces as + and it works: http://twitter.com/home?status=%40user+blah%2Cblah%2Cblah+%23hashtag

这篇关于推特网址编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆