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

Query String Problem Parsing #87

Closed
zhiephie opened this issue Apr 3, 2020 · 1 comment
Closed

Query String Problem Parsing #87

zhiephie opened this issue Apr 3, 2020 · 1 comment

Comments

@zhiephie
Copy link

zhiephie commented Apr 3, 2020

Url looks like this https://api.test/starter/province?0%5Bid%5D=12
the code:

public function request(string $path, array $param = [], $type = 'GET')
{
        $response = Http::withHeaders(['key' => $this->apiKey])
            ->get($this->url($path), [
            $param
        ]);

        //return $response->body();
        return $response; //debug
}

public function getProvince($idProvince)
{
      return $this->request('province', ['id' => $idProvince]);
}

and consume the function

var_dump($test->getProvince(12));

output

 private $handlerStats =>
    array(31) {
      'url' =>
      string(56) "https://api.test/starter/province?0%5Bid%5D=12"
      'content_type' =>
      string(16) "application/json"
      'http_code' =>
      int(200)
      'header_size' =>
      int(126)
      'request_size' =>
      int(164)
      ...
    }

so how can i send URL like this https://api.test/starter/province?id=12

Thanks

@zhiephie
Copy link
Author

zhiephie commented Apr 4, 2020

sorry, my code is wrong 🔨

@zhiephie zhiephie closed this as completed Apr 4, 2020
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

1 participant