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:
Concatenate:
$twitter->call('site.com/person.php?person=' . $curr_person);
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.
精彩评论