Git Product home page Git Product logo

Comments (6)

djaho avatar djaho commented on June 26, 2024 2

Hi,
I know this is a very old issue for a project which is essentially dead. But I had a similar issue with a newer version of a plugin and maybe my answer will help somebody somewhere.
My issue was that the login to phplist failed for new sessions, but it succeeded for all subsequent sessions. This happened because the curl request sent a session cookie which already expired (from previous session) and phplist refused the login.
So the fix was quite simple.
You just have to add CURLOPT_COOKIESESSION to the curl request whenever you try to create a new session. It is best to extend the callApi function to accept a new parameter $newSession (true/false) and then use it like this
curl_setopt($c, CURLOPT_COOKIESESSION, $newSession);

When you call it from login function, pass the $newSession parameter as true and when called from other functions, set it to default to false.

A link to the curl documentation:
http://php.net/manual/en/function.curl-setopt.php

from phplist-plugin-restapi.

djaho avatar djaho commented on June 26, 2024 2

@samtuke I will test my change for some more time and if all will be well, I will make a pull request. Even though this will be my fist Github pull request :)

Thanks for the info about the updater. I will definitely check the new rest api.

from phplist-plugin-restapi.

michield avatar michield commented on June 26, 2024

Problems like that are hard to debug. It could be connectivity issues, like DB or network. Best thing to do is to hack the code and add some logging in places and see how far it gets.

from phplist-plugin-restapi.

samtuke avatar samtuke commented on June 26, 2024

Thanks for sharing. Do you plan to migrate to the new REST API (https://github.com/phpList/rest-API) at some stage?

from phplist-plugin-restapi.

djaho avatar djaho commented on June 26, 2024

Thanks for your comment Sam. Right now, I am personally not planning on migrating to the new rest api, as the current one works good enough for me and I find it much easier to modify it for my purposes.
And also, I think I had some issues (I don't remember what exactly) installing the new REST API to phplist (v3.3.5). And I remember that it was just a lot easier to install the old version of REST API ;)

from phplist-plugin-restapi.

samtuke avatar samtuke commented on June 26, 2024

@djaho OK, even though the REST API that you're using is no longer maintained, we would welcome pull requests with the improvements that you've made.

A new version of phpList will be released shortly which includes an automatic updater. In future releases that updater will allow installing the new REST API also, which should make it easier for you to set it up and try it out.

from phplist-plugin-restapi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.