Comments (6)
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.
@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.
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.
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.
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.
@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)
- Remove passwords from subscriberHandler get methods HOT 1
- Support for bulk operations
- "No function for provided [cmd] found!" when I try to subscribe
- POST <html> from php curl comes escaped - deal with it receiver-side? HOT 6
- SQL Syntax error (SQLSTATE[42000]) with command campaignsGet when setting value to limit or offset parameters
- Sorting is not working with the command campaignsGet
- campaignUpdate: parameter was not defined
- phplist returning 400 bad request? HOT 3
- Structure.md Authentication section is outdated
- Change the GitHub repository description HOT 5
- Request Limitation?
- Namespace HOT 1
- campaignUpdate fails due to busted SQL call
- HTML message links are mangled HOT 1
- Fetch Campaign statistics opened/clicks
- No setting fields HOT 3
- subscriberGetByEmail HOT 3
- 0020235: Rest Api: subscriberUpdateAttributes is not working as per documentation HOT 1
- Duplicate subscriberUpdateAttributes API call HOT 2
- No DB server port or socket from configuration.php set in pdo.php HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phplist-plugin-restapi.