Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with POST parameters being separated by "&" instead of "&" #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tgmayfield
Copy link

I battled for way too long to get the Moodle enrol_manual_enrol_users service to work. I finally got it working correctly with PHP curl functions, and then had to compare why that one worked and this code didn't. It came down to ampersands being in the POST data.

CURL post data:

enrolments%5B0%5D%5Broleid%5D=5&enrolments%5B0%5D%5Buserid%5D=8&enrolments%5B0%5D%5Bcourseid%5D=48&enrolments%5B0%5D%5Btimestart%5D=1693551600&enrolments%5B0%5D%5Btimeend%5D=1697353200

MoodleRest post data:

enrolments%5B0%5D%5Broleid%5D=5&enrolments%5B0%5D%5Buserid%5D=8&enrolments%5B0%5D%5Bcourseid%5D=48&enrolments%5B0%5D%5Btimestart%5D=1693548000&enrolments%5B0%5D%5Btimeend%5D=1697349600

@llagerlof
Copy link
Owner

@tgmayfield, thank you for taking the time to debug a potential problem with the library.

I find it strange because I use it to make GET and POST requests to more than one Moodle webservices in production systems and have never had an issue - works on my machineS ;-)

This makes me think that the error you're encountering is an exception. Based on your discovery, I'll try to reproduce this problem to determine if the solution you found works for all cases or if the root of the problem is something deeper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants