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

POST has to be explicitly defined using CURLOPT_CUSTOMREQUEST #14

Closed
asaeles opened this issue Jul 13, 2018 · 2 comments
Closed

POST has to be explicitly defined using CURLOPT_CUSTOMREQUEST #14

asaeles opened this issue Jul 13, 2018 · 2 comments

Comments

@asaeles
Copy link

asaeles commented Jul 13, 2018

I tried running two consecutive PHP cURL outputs with two to the same URL, first one is set to OPTIONS:

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "OPTIONS");

Second one is supposed to be POST but only the CURLOPT_POST was set:

curl_setopt($ch, CURLOPT_POST, 1);

But after running the PHP script the second -supposedly- "POST" request kept returning empty result for no particular reason, but after enabling the verbose flag on cURL I discovered that the second request was still set to OPTIONS, so I had to add:

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");

@asaeles
Copy link
Author

asaeles commented Jul 14, 2018

Similar problem happened when a GET command succeeded a POST command, I had to add this line to the GET command disable the cURL option from the previous command:

curl_setopt($ch, CURLOPT_POST, false);

@incarnate
Copy link
Owner

Hi @asaeles,
Thanks for raising the issue, sorry to be slow to look at this one.

The issue seems to be in reusing a curl object for multiple requests. There isn't much this tool can do to help with that without setting almost every flag to its default value, which is a bit beyond what this is for.

I'll close this off, but if you've any further suggestions please post.

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

No branches or pull requests

2 participants