I am accessing a 3rd part API for an integration script I'm developing. It has a 3 step process in creating a userid (1. get a token 2. login as admin 3. do admin stuff)

I've scripted it via server side script that is triggered on a new user being created in our application.

example:

$token = get_url("/api.php?action=token");

get_url("/api.php?action=login&username=username&password=password&token=".$token);

get_url("/api.php?action=dostuff&token=".$token);

get_url("/api.php?action=logout&token=".$token);

The problem that I am running into is that get_url and fopen do not appear to retain session state. As a result the 'do stuff' command fails as the admin login is not recognized. If I cut and paste the exact same commands into the browser URL everything works.

Any suggestions from the masses on how to accomplish this server side in PHP?

Thanks!

I've contacted the owner of the API and they have confirmed it is an issue with their code.

Nothing to see, move along ;-)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.