Educational Purpose: Connect PHP code to Weather API

Ολοκληρωμένο Αναρτήθηκε Πριν 1 χρόνο Πληρώθηκε κατά την παράδοση
Ολοκληρωμένο Πληρώθηκε κατά την παράδοση

Already have the code and just need this fixed, I have the API key in the code:

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="utf-8">

<title>My Weather</title>

</head>

<body>

<p> are you comfortable with php? question</p>

<?php

$conn = new mysqli("localhost","root","","ia3weather") or die(mysqli_error($conn));

$query = mysqli_query($conn, "SELECT * FROM stations ORDER BY name ASC") or die(mysqli_error($conn));

echo '<form action="'.htmlentities($_SERVER['PHP_SELF']).'" method="get">';

echo '<select name="wmo" onchange="[login to view URL]()">';

echo '<option value="00000">Select Station</option>';

if (isset($_GET['wmo'])) {

$wmo = $_GET['wmo'];

} else {

$wmo = '00000';

}

while ($row = mysqli_fetch_array($query)) {

if ($row['wmo'] == $wmo) {

$selected = ' selected ';

} else {

$selected = ' ';

}

echo '<option value="'.$row['wmo'].'"'.$selected.'>'.$row['name'].'</option>';

}

echo '</select> ';

echo '</form>';

if ($wmo != '00000') {

$query = mysqli_query($conn, "SELECT * FROM stations WHERE wmo=$wmo") or die(mysqli_error($conn));

while($row = mysqli_fetch_array($query)) {

echo '<a href="[login to view URL]@'.$row['lat'].','.$row['lon'].',14z" target=\"_blank\">Map</a>';

echo '<p>Name: '.$row['name'].'</p>';

}

$query=mysqli_query($conn, "SELECT * FROM observations WHERE wmo='$wmo' ORDER BY datetime DESC LIMIT 5") or die(mysqli_error($conn));

while ($row = mysqli_fetch_array($query)) {

echo $row['datetime'].': '.$row['air_temp'].'<br>';

}

$places = array("94578"=>"Brisbane", "95551"=>"Toowoomba", "94578"=>"Logan");

$url = '[login to view URL]'.$places["$wmo"];

$result = file_get_contents($url);

$json = json_decode($result, true);

echo 'Maximum tomorrow: '.$json["forecast"]["forecastday"][1]["day"]["maxtemp_c"];

/*

$url = '[login to view URL]'. $places["$wmo"];

$xml = simplexml_load_file($url);

echo 'Maximum tomorrow:'.$xml->forecast->forecastday[1]->day->maxtemp_c;

*/

}

?>

</body>

</html>

PHP MySQL JavaScript HTML API

Ταυτότητα Εργασίας: #35098215

Σχετικά με την εργασία

7 προτάσεις Απομακρυσμένη εργασία Ενεργό Πριν 1 χρόνο

Ανατέθηκε στον:

tariqs028

Hi, Ready to start working on your project. I have read your requirements of your project and have expertise in this project related things. I have to discuss something with you related to this project. Let's discuss Περισσότερα

$10 AUD σε 1 μέρα
(43 Αξιολογήσεις)
5.2

7 freelancers κάνουν προσφορές κατά μέσο όρο $26 για αυτή τη δουλειά

caciocode

Hi, I am a PHP developer. I can make changes and fix issues in your PHP code.

$20 AUD σε 1 μέρα
(379 Αξιολογήσεις)
7.2
tyleleerking

✔️Hi there✔️ this is tyler i have interesting your project I 100% guarantee that I will help you and make you satisfied. Because, I just worked on a project very similar to yours. As a senior web developer, I've exper Περισσότερα

$30 AUD σε 1 μέρα
(18 Αξιολογήσεις)
4.6
Jarretdev

Hello friend As I am senior web developer, I am confident on your project I can start right now ,and I can satisfy your requirements. Thanks

$30 AUD σε 1 μέρα
(10 Αξιολογήσεις)
4.5
minqunshao

Hello I checked your code and can perfectly fix. thanks......

$30 AUD σε 1 μέρα
(9 Αξιολογήσεις)
5.2