Hello/Hi/Greetings,
I'm trying to use piwigo's api login to enable users to login in their piwigo account if they login on my front site.. i'm getting a "string(27) "{"stat":"ok","result":true}" response.. however the user is still not logged in... am i getting something wrong??
................ a snipper of a php file i'm working on...
$url = "http://127.0.0.1/gallery/ws.php?format=json&method=pwg.session.login";
# Our new data
$data = array(
'username' => "testuser01",
'password' => 'testuser01',
);
function curl_post($url, $post,array $options = array())
{
$defaults = array(
CURLOPT_POST => 1,
CURLOPT_HEADER => 0,
CURLOPT_URL => $url,
CURLOPT_FRESH_CONNECT => 1,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_FORBID_REUSE => 1,
CURLOPT_TIMEOUT => 4,
CURLOPT_POSTFIELDS => http_build_query($data)
);
$ch = curl_init();
curl_setopt_array($ch, ($options + $defaults));
if( ! $result = curl_exec($ch))
{
trigger_error(curl_error($ch));
}
curl_close($ch);
return $result;
}
$res = curl_post($url,$data);
var_dump($res);
any help is appreciated
Offline