Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

URL convert into guzzle request

i need to convert this URL into guzzle request

explorer/?method=GET&path=930657230472626%2Fratings%3Ffields%3Dopen_graph_story%2Creviewer&version=v3.2&classic=1

the only problem is how to set multiple values for fields param as you can see it's take two values

fields=open_graph_story,reviewer

so how i convert this into guzzle request here is request which i made so far

 $this->client->request('GET', "/URL", [
      'query' => [
          'fields' => ['open_graph_story', 'reviewer']
       ],
 ]);
like image 457
Usman Jdn Avatar asked Feb 27 '26 23:02

Usman Jdn


1 Answers

The fields parameter value is just a comma-separated string of field names, so you want to use

'fields' => 'open_graph_story,reviewer'

(With 'fields' => ['open_graph_story', 'reviewer'] you would get something like
…&fields[0]=open_graph_story&fields[1]=reviewer in the resulting URL, but the API just wants one value.)

like image 188
misorude Avatar answered Mar 02 '26 13:03

misorude



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!