Gegevens uit een stuk script halen
Ik ben bezig met het inloggen van Social media's.
Ik kan door middel van
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
if (!isset($_SESSION['UserID']))
{
print '<h2>Not signed in</h2>';
print '<p>You have not signed in yet through a social network.</p>';
}
else
{
print '<p>You are currently signed in as a React OAuth user known by the user ID `'. htmlspecialchars($_SESSION['UserID']).'`.</p>';
print '<p>Get the basic profile data for one of your connected providers:</h2>';
print '<form method="post">';
$connectedProviders = $react->OAuthServer->userGetProviders($_SESSION['UserID']);
foreach ($connectedProviders['connectedWithProviders'] as $provider)
{
print '<input type="submit" name="provider" value="'. htmlspecialchars($provider) .'" />';
}
print '</form>';
if (isset($_POST['provider']))
{
$result = $react->OAuthServer->userGetProfile($_SESSION['UserID'], $_POST['provider']);
print '<h2>Basic social profile data for '. htmlspecialchars($_POST['provider']) .':</h2>';
var_dump_pretty($result);
}
}
?>
if (!isset($_SESSION['UserID']))
{
print '<h2>Not signed in</h2>';
print '<p>You have not signed in yet through a social network.</p>';
}
else
{
print '<p>You are currently signed in as a React OAuth user known by the user ID `'. htmlspecialchars($_SESSION['UserID']).'`.</p>';
print '<p>Get the basic profile data for one of your connected providers:</h2>';
print '<form method="post">';
$connectedProviders = $react->OAuthServer->userGetProviders($_SESSION['UserID']);
foreach ($connectedProviders['connectedWithProviders'] as $provider)
{
print '<input type="submit" name="provider" value="'. htmlspecialchars($provider) .'" />';
}
print '</form>';
if (isset($_POST['provider']))
{
$result = $react->OAuthServer->userGetProfile($_SESSION['UserID'], $_POST['provider']);
print '<h2>Basic social profile data for '. htmlspecialchars($_POST['provider']) .':</h2>';
var_dump_pretty($result);
}
}
?>
Kan ik in de browser mijn login gegevens van een social media weergeven maar hoe kan ik die gegevens opslaan in m'n database?
B.v.d, Joey
Wat wil je allemaal opslaan dan? Want wat ik hier zie is dat je alleen een UserID hebt en een provider meer niet. Wat wil je bereiken met het opslaan van deze 2 dingen?
Code (php)
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
<?php
if (isset($_POST['provider']))
{
$result = $react->OAuthServer->userGetProfile($_SESSION['UserID'], $_POST['provider']);
print '<h2>Basic social profile data for '. htmlspecialchars($_POST['provider']) .':</h2>';
var_dump_pretty($result);
}
?>
if (isset($_POST['provider']))
{
$result = $react->OAuthServer->userGetProfile($_SESSION['UserID'], $_POST['provider']);
print '<h2>Basic social profile data for '. htmlspecialchars($_POST['provider']) .':</h2>';
var_dump_pretty($result);
}
?>
Bij de "var_dump_pretty($result);" komt dit te staan in de browser;
array(7)
{
"real_name" => string(14) "Joey Schröder"
"user_name" => string(12) "joeyschroder"
}
Die wil ik opslaan in m'n database. Hoe pak ik dat aan?
Toevoeging op 22/03/2012 11:05:38:
Iemand enig idee?
Ik heb nu tussen deze lijnen;
Code (php)
1
2
3
4
5
6
2
3
4
5
6
<?php
$result = $react->OAuthServer->userGetProfile($_SESSION['UserID'], $_POST['provider']);
print '<h2>Basic social profile data for '. htmlspecialchars($_POST['provider']) .':</h2>';
var_dump_pretty($result);
?>
$result = $react->OAuthServer->userGetProfile($_SESSION['UserID'], $_POST['provider']);
print '<h2>Basic social profile data for '. htmlspecialchars($_POST['provider']) .':</h2>';
var_dump_pretty($result);
?>
heb ik $result = $_POST['result']; gezet maar nu krijg in ik de browser te zien NULL...
enig idee
Gewijzigd op 22/03/2012 11:06:25 door Joey Schroder