开发者

Passing in a PHP variable into a Twitter Callback URL

I want twitter to send a user back to

site.com/person.php?person=$curr_pe开发者_如何学JAVArson

where $curr_person is a session variable stored in $_SESSION['person'] and obtained from $_GET['person']

Problem is when Twitter redirects back to my site $curr_person is not evaluated and is taken literally. I assume the redirect doesn't hit my server...how can I get the call back URL to be evaluated properly?

Thanks


The reason it is not evaluated is probably because you entered it as a part of the string like that:

$twitter->call('site.com/person.php?person=$curr_person');

But there are two solutions:

  1. Concatenate:

    $twitter->call('site.com/person.php?person=' . $curr_person);
    
  2. Use double quotes:

    $twitter->call("site.com/person.php?person=$curr_person");
    

Hope this helps.

Ps. Of course I am assuming you are passing this URL to some method (like $twitter->call()), so do not just copy the code - just get familiar with the way both solutions differ from the code at the beginning of my answer.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜