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

send function do no accept array ... on line 408 #123

Open
coscho opened this issue Jun 1, 2017 · 1 comment
Open

send function do no accept array ... on line 408 #123

coscho opened this issue Jun 1, 2017 · 1 comment

Comments

@coscho
Copy link

coscho commented Jun 1, 2017

public static function send($method, $url, $body = null, $headers = array(), $username = null, $password = null)
{
self::$handle = curl_init();

    if ($method !== Method::GET) {
        if ($method === Method::POST) {
            curl_setopt(self::$handle, CURLOPT_POST, true);
        } else {
            if ($method === Method::HEAD) {
                curl_setopt(self::$handle, CURLOPT_NOBODY, true);
            }
            curl_setopt(self::$handle, CURLOPT_CUSTOMREQUEST, $method);
        }
        // to accept array http_build_query must me used
        curl_setopt(self::$handle, CURLOPT_POSTFIELDS, http_build_query($body));
    } elseif (is_array($body)) {
        if (strpos($url, '?') !== false) {
            $url .= '&';
        } else {
            $url .= '?';
        }

        $url .= urldecode(http_build_query(self::buildHTTPCurlQuery($body)));
    }
@rayliverified
Copy link

This is a pretty critical issue.

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