I am trying to make a httpcallout to "https://www.carrierlookup.com". When I tried it with browser's apex rest client extension it returned correct response :
{"Response":{"creditBalance":"985","number":"2067998555","carrier_type":"mobile","carrier":"verizon"}}
but when I tried using apex code and debug response using res.getBody(),it showed html response:
<table border="0" cellpadding="4" cellspacing="0">
<thead>
<tr>
<th>Response</th></tr>
</thead>
<tbody>
<tr>
<td Response='Array'></td><td>Array</td></tr>
</tbody>
</table>
I have used below code for callout :
HttpRequest req = new HttpRequest();
req.setEndpoint(endUrl );
req.setMethod('GET');
req.setHeader('Content-Type', 'text/plain');
req.setTimeout(120000);
Http http = new Http();
HttpResponse res = http.send(req);
Can anyone suggest why it is showing this type of response and How can I get the correct result ?