How do I use API in PHP to query Remote database instead of server database?

100 Views Asked by At

I need to include an "API URL" and an "API Key" somewhere in this PHP script block?

// prepare post/get
if (strtoupper($_SERVER['REQUEST_METHOD']) == 'POST' && is_array($_POST['f'])) {
$form_data = $_POST['f'];
unset($_POST['f']);
$_POST = is_array($_POST) ? array_merge($_POST, $form_data) : $form_data;
} elseif (strtoupper($_SERVER['REQUEST_METHOD']) == 'GET' && is_array($_GET['f'])) {
$form_data = $_GET['f'];
unset($_GET['f']);
$_GET = is_array($_GET) ? array_merge($_GET, $form_data) : $form_data;
}

I need to output data from the remote API URL call. I can see that the above script block is set to query my server database but I need it to query the remote API server. I have no PHP knowledge and need help in PHP.

0

There are 0 best solutions below