rest api (client side) is working fine on local server but not on online server

1k views Asked by At

The following code works fine on local server but on online server throws HTTP ERROR 500. cURL is also enable. Have checked the error log it say;

AH01071: Got error 'PHP message: PHP Fatal error: Uncaught exception 'Pph\ApiClientException' with message 'Unknown error HTTP/1.1 400 BAD REQUEST\r\nSe

$tcom = $ApiClient->apiCall('get', 'companies');
echo "<table>"; 
foreach($tcom as $key=>$value){

  foreach($value as $k => $v){
    echo'<tr>';
    echo '<td>'  . $k . '</td>';
    echo '<td>'  . $v . '</td>';
    echo '</tr>';
  }
}
echo "</table>";
1

There are 1 answers

0
Taslim On BEST ANSWER

Have to provide one (human, phpserialize, json) as URL parameter like this: &format=phpserialize\n)\n'

Example: $tcom = $ApiClient->apiCall('get', 'companies&format=phpserialize');