0
I made this question today, helped me a lot, now I have the code:
foreach ($tokens as $row) {
$token1[] = $row['oauth_token'];
$token2[] = $row['oauth_token_secret'];
}
var_dump($token1);
var_dump($token2);
And he returns to me:
I wanted to turn these tokens all into 1 index only how can I do this?
Example:
0 => string 'todos aqui';
========================================
EDIT:1
I want to extract the contents, from arrays for example, I now have this:
using this code:
while ($tokens = $this->selectTokens()) {
foreach ($tokens as $row) {
$tokenList[] = [
'oauth_token' => $row['oauth_token'],
'oauth_token_secret' => $row['oauth_token_secret'],
];
}
#$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $tokenList['oauth_token'], $tokenList['oauth_token_secret']);
var_dump($tokenList);
break;
}
Well I guess I figured it out by now, now I want you to understand this:
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $tokenList['oauth_token'], $tokenList['oauth_token_secret']);
I mean, get them all oauth_token
and oauth_token_secret
, that comes from a banco de dados
, to make a looping. But in doing so I get this:
Right here $tokenList['oauth_token'], $tokenList['oauth_token_secret']
But all together in one
string
? or astring
for theoauth_token
and another to theoauth_token_secret
?– Isac
That, I need to go to Twitteroauth see this print of how it looks now: http://prntscr.com/g09nwb, the problem is to recover them now. With the answer code below, I did everything, but only returns 1, I need to return all, example tokenList[1] returns http://prntscr.com/g09ohu, I need to separate this. for example tokenList['oauth_token'] and tokenList['oauth_token_secret']
– WillBB
But then I’d stay for the
oauth_token
with 1 token 500 characters long? That’s the idea?– Isac
The idea is to return, all tokens both token, secret understood? in a loop and pass Twitteroauth: see if you can understand with this print http://prntscr.com/g09r6p, but doing so from the Undefined index: oauth_token
– WillBB
Obs: these tokens come from
Banco de Dados
– WillBB
As far as I have seen in the Twitter documentation this class can only receive 1 oath_token and 1 oath_token_secret. Then putting more in a string probably wouldn’t work, but I may have gotten the wrong idea.
– Isac
Isac works, I have a similar code but using
mysql_*
with PDO I’m having problems.– WillBB
That instruction has to be within the
for
at the end of it, and will create a connection for each token/$row
– Isac
Do you have an example? I don’t mean to be ignorant, but I don’t understand :(
– WillBB
I edited my answer with an example of what I was trying to say
– Isac