I integrated a remote API with my PHP web application using Saloon. I usually set my query parameter on my Request
like this:
$this->query()->set([
'param1' => 'val1',
'param2' => 'val2',
'param3' => ['val3', 'val4']
]);
This works perfectly and I get the expected URL/?param1=val1¶m2=val2¶m3[]=val3¶m3[]=val4
.
But now I'm dealing with a remote endpoint that expects multiple parameters with the same name and different values, as in /?param1=val1¶m2=val2¶m3=val3¶m3=val4
, How can I obtain this with Saloon?
My solution was to manually build the endpoint URL directly, so that my resolveEndpoint()
returns the full URL /?param1=val1¶m2=val2¶m3=val3¶m3=val4
.
It's definitely not the prettiest solution ever, but it gets the job done.