0

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. Thanks :)

user3783243
  • 5,368
  • 5
  • 22
  • 41
Cliff
  • 1
  • 2
  • 1
    The code shown is neither querying a database nor an external API. It's not really clear what you're trying to ask. – David Nov 14 '22 at 21:09
  • Does this answer your question? [Call a REST API in PHP](https://stackoverflow.com/questions/9802788/call-a-rest-api-in-php) – computercarguy Nov 14 '22 at 21:10
  • `I need it to query the remote API server`...usually this is done by making a PHP request. – ADyson Nov 14 '22 at 23:52
  • `I have no php knowledge`...well we can't teach you, so you'll need to learn some before we can help with your specific issue. It's expected you make some effort to solve the problem yourself before asking for the free time of others. Extended tutorials, lessons, or free code-writing from scratch for those without the necessary core skills, are not services Stackoverflow provides. If you're not a programmer, please hire one. If you are, and have a specific problem / bug in your code based on your prior research and efforts to implement what you need, please ask that. See [ask] and the [tour] – ADyson Nov 14 '22 at 23:54
  • Not looking for free help or anyone's free time. Thank you! ADyson – Cliff Nov 15 '22 at 22:33

0 Answers0