duanqinjiao5244 2009-10-14 16:28
浏览 73
已采纳

更新Twitter状态:字符转义和URL

I pass text from a POST variable from a form on my site to Twitter and I save this message on my own site. When I view the entry on my site it is absoultly fine. However, in some cases when there is an apostrophe in the message twitter updates the status of a user but escapes the apostrophes and this can be seen on the users status!

This doesn't happen when I update my twitter status on the twitter site. So I am wondering is there a way I need to pass text to twitter?

I currently do this and I make use of this awesome Twitter class. http://github.com/jmathai/twitter-async/tree

$success = $twitterObj->post_statusesUpdate(array('status' => $_POST['message'].$URL.$key));

In addition, passing URLs to twitter use to automatically link the URL but now this just appears as text?

Has twitter made changes in the past month that would cause the above to happen? If not how can I overcome this?

Thanks all

EDIT

More Code:

function tweetit(){
    global $URL;
    global $key;

    include './twitter/EpiCurl.php';
    include './twitter/EpiOAuth.php';
    include './twitter/EpiTwitter.php';

    $consumer_key = 'hidden';
    $consumer_secret = 'hidden';

    $twitterObj = new EpiTwitter($consumer_key, $consumer_secret);

    $twitterObj->setToken($_SESSION['oauth_token'], $_SESSION['oauth_token_secret']);

    $success = $twitterObj->post_statusesUpdate(array('status' =>  $_POST['message'].' '.$URL.$key));

    return $success->response['id']; 
}
  • 写回答

5条回答 默认 最新

  • dongshanxun6479 2009-10-14 21:16
    关注

    Sounds like your php config has magic_quotes_gpc turned on, which automagically calls addslashes on all input (e.g., your POST values). I'd read up on addslashes/stripslashes in the php manual.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题