-
Notifications
You must be signed in to change notification settings - Fork 62
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
Add support for parameters to GET requests #12
base: master
Are you sure you want to change the base?
Conversation
With the latest commit, this has been tested and functions properly. WIll wait a few days for feedback, then merge if nobody has any concerns. |
i will check and test it tonight :) |
// longer, so we need to build them into the query string ourselves. | ||
$action_postfields_string = http_build_query($put_post_parameters); | ||
$action_path .= (strpos($action_path, '?') === FALSE ? '?' : '&') . $action_postfields_string; | ||
unset($action_postfields_string); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
love the use of unset :) memory savings ftw
it not working , because the class send the first request $action_path before the the switch case . so the get parametre is set later , and it should build with the $action_path before it sended . |
moving the line curl_setopt($prox_ch, CURLOPT_URL, "https://{$this->hostname}:{$this->port}/api2/json{$action_path}"); to the end of switch case , do the trick . |
Sorry for the delay on this one. I made these adjustments to the code and thought I'd pushed them, then I lost Internet access until just a few minutes ago, so I just now saw that the changes weren't pushed after all. Go ahead and give it another go now. |
this is still not working ... anyone has tested this ? |
Addresses GitHub Issue CpuID#8 - Set parameters as CURLOPT_POSTFIELDS, which cURL will automatically translate into the URL query string. This lets us pass the ?params versus ¶ms logic off to cURL, which makes the code easier to maintain. - Allow all parameters passed to be empty by making the argument optional on GET, POST, and PUT. This is mostly for consistency. Signed-off-by: Daniel Hunsaker <[email protected]>
Addresses GitHub issue CpuID#8 - cURL appears to not (or at least to no longer) actually support turning POSTFIELDS into query string parameters, so we have to build the query string ourselves. This update does just that. Signed-off-by: Daniel Hunsaker <[email protected]>
Signed-off-by: Dan Hunsaker <[email protected]>
Signed-off-by: Dan Hunsaker <[email protected]>
4ee7d36
to
0adb4a7
Compare
Addresses GitHub Issue #8
This lets us pass the ?params versus ¶ms logic off to cURL, which makes the code easier to maintain.
This is mostly for consistency.
Signed-off-by: Daniel Hunsaker [email protected]