Customizing SMF > Bridges and Integrations


<< < (2/19) > >>

hi I want to integrate mysite with smf forum in order member in mysite don't need to login twice ... but I got problem.....I using this...
--- Code: ---require_once('SmfRestClient.php');

$secretKey = '123456';
$api = new SmfRestClient($secretKey);


$api->authenticate_user('greenhorse', '123456');
--- End code ---
but  it doesn't work?
I think after I using it I don't need login in smf forum anymore.....any suggestion? :(

Andre N:

This login doesn't set the login cookie on the user browser, it set's it in curl's cookiejar, and the login is only going to be valid for the current API session. Theoretically you could use curl to login and set the login cookie like jquery does, but I haven't had time to mess with it.
It also won't log the user out, as it is intended to run from a different domain and cross-domain policy won't let you delete the cookie. Again, maybe this can be done with curl.

If you're on the same domain, use the regular API, which will let you login and logout easily.
Otherwise I'd recommend examining jquery's smf login method and duplicating that.

hi..yes I using forum and mysite in same domain.... I have used your api but it doesn't work.... :(

log out function doesn't work....

--- Code: ---require_once ( 'smf_2_api.php');

--- End code ---

login function also doesn't work...

--- Code: ---
require_once ( 'smf_2_api.php');
smfapi_authenticate('ankifreeze', '123456')
--- End code ---

Andre N:
hi, I will reply to your usage of the regular API in it's thread ;)


I've installed a new copy of SMF (v.2.0.2) and used your "REST" api.  I tried the very basic function which is login below is the code and results I received.

--- Code: ---require_once('SmfRestClient.php');

$secretKey = 'sdgefgbdbdvberger4564trgdfgdfvcvv';
$api = new SmfRestClient($secretKey);
$result = $api->login_user('');

--- End code ---

And the result when i user print_r is

--- Code: ---stdClass Object ( [data] => true [error] => )

--- End code ---

Can you point me where I should check for the error since the code does not log in the user to the SMF forum. 

Thank you,



[0] Message Index

[#] Next page

[*] Previous page

Go to full version