I do not get any data on an open page when doing echo, I am not sure if it is on the correct place, or doing something wrong
<pre><?php
if ((isset($_POST['db'])) && ($_POST['db'] == 'LifeCoinWatchDB'))
{
$sql = mysqli_query($pdo,"SELECT * FROM api_currency ");
$row = mysqli_fetch_array($pdo);
$LIVECOINWATCH_API = $row['LIVECOINWATCH_API'];
$data = json_encode(array('currency' => 'USD', 'sort' => 'rank', 'order' => 'ascending', 'offset' => 0, 'meta' => false));
$headers = array(
"content-type: application/json",
"x-api-key: LIVECOINWATCH_API",
);
$qs = http_build_query($data);
$url = "https://api.livecoinwatch.com/coins/list";
$request = "{$url}?{$qs}";
echo $url;
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $request,
CURLOPT_HTTPHEADER => $headers,
CURLOPT_RETURNTRANSFER => 1
));
$response = curl_exec($curl);
curl_close($curl);
$decoded_json_lifecoinwatch = json_decode($response, true);
foreach($decoded_json_livecoinwatch['data'] as $livecoinwatch)
{
$LIFECOINWATCH_code = $livecoinwatch['CODE'];
$LIFECOINWATCH_name = $livecoinwatch['NAME'];
$LIFECOINWATCH_name = htmlentities($LIFECOINWATCH_name, ENT_QUOTES, "UTF-8");
$checkSql = mysqli_query($pdo,"SELECT * FROM lcw_munt_lys WHERE CODE = '$LIFECOINWATCH_code' ") or die(mysqli_error($pdo));
$checkSqlCount = mysqli_num_rows($checkSql);
if($checkSqlCount > 0){
}
else{
$insertSql = mysqli_query($pdo,"INSERT INTO lcw_munt_lys (CODE, NAME) VALUES('$LIFECOINWATCH_code', '$LIFECOINWATCH_name')") or die(mysqli_error($pdo));
}
}
}
?>
What I have tried:
I have put the echo on different places, and still empty page