Try cleaning it up
$url = sprintf('https://api-sandbox.xxxxxx.co/SG/2.0/reports/waybill?tids=%s&h=0', $response['tracking_number']);
I made an external API call to generate airbill. I have to pass in a tracking number into the URL. It's like:
//generate airway bill for order created
$url = "https://api-sandbox.xxxxxx.co/SG/2.0/reports/waybill?tids=".$response['tracking_number']."&h=0";
$airwaybill_response = Http::withToken($token)->get($url);
The response tracking number is my response from order creation API which returns as a json as string value.
When I dd($url), it returns the URL correctly like $url = "https://api-sandbox.xxxxxx.co/SG/2.0/reports/waybill?tids=MKS321&h=0"; but it couldn't receive response when I call the API as it says order could not be found.
I tried using the tracking number directly(without variable/concatenate) :
$url = "https://api-sandbox.xxxxxx.co/SG/2.0/reports/waybill?tids=MKS321&h=0";
and it works. To sum it up, using url with the actual tracking number can work but concatenate it with variable(with same tracking number) could not work.
Did I overlook something?
Please or to participate in this conversation.