Jump to content

access logged user from php page


lucabek

Recommended Posts

file_get_contents is not able to handle cookies. curl is. Therefore, you won't be able to solve this with file_get_contents.

But anyway - why use curl? You could call any function / controller within your script without the need of using this external tools.

Link to comment
Share on other sites

I have made an API on the server prestashop that return the current logged user as xml, if I call it by URL, it works fine, if in server B I include I frame with src of API I see user data, but with curl or Ajax getjson I see no logged user, this is the problem! Do you have idea how to pass a cookie or session to curl!???

Link to comment
Share on other sites

Probably easier to get to a solution if you describe what your goal exactely is?

 

And - what is logged in user. An admin or a customer?

If latter is the case. There are tables like ps_guest and ps_connections. There you find all data from stored connections with customer id.

Link to comment
Share on other sites

Curl needs to know the session id. If you don't pass it, you don't get a result. Why not allow the remote server to access the prestashop database?

All information is available there.

 

And you didn't explain what your real goal would be.

Link to comment
Share on other sites

Mail address would be convenient as well - and the user might know his address. Once he enters it, you fill up the rest. Or your could pass the customer_id as parameter with the link to the external site. So the remote server would know what to look up.

Edited by Scully (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...