Php Training

BySlide Scope

How to use openweathermap api with PHP

Openweathermap api with PHP

In this tutorial we are going to discuss about a useful API from openweathermap.org. Its API can be used to display Current weather and 13 day Forecast data.

It displays following data:

  • Minimum Temperature
  • Maximum Temperature
  • Wind Speed
  • Humidity Value
  • Weather Condition and other details.

Using PHP to Develop your own weather checking website :

Step 1 – Go to Openweathermap.org and register to get your free or paid api key (app_id).

Step 2 – Create a PHP file and write HTML code for a Simple Form.

<form method=”post”>

<label for=”city”>

Enter Location Name :

</label>

<input class=”form-control” id=”searchTextField” name=”city” placeholder=”Enter a location” autocomplete=”on”>

<!–<label for=”cc”>

Country Code (Eg: IN for India):

</label>

<input class=”form-control” name=”cc”>–>

<button class=”btn btn-success” type=”submit” name=”sub”>View</button>

</form>

Using the form given above users will enter the name of their city.

Step – 3 Write the following php code:

<?php

                if (isset($_POST[‘sub’])){

$city = $_POST[‘city’];

$country = $_POST[‘cc’];

$url=”http://api.openweathermap.org/data/2.5/weather?q=”.$city.”,”.$country.”&units=metric&cnt=7&lang=en&appid={Your-APi-key}”;

//Replace your API key with your key.

//When user will submit the query, $_POST variable will be set and you have supply these variable in the url.

//The above given url produced JSON output. Now write:

$json=file_get_contents($url);

$data=json_decode($json,true);

echo “<h2>Current Temperature in ” . $city . ” is :<button class=’btn btn-success’>” . $data[‘main’][‘temp’] . “&#176; Celcius</button></h2>”;

echo “<h2>Wind Speed is :<u>” . $data[‘wind’][‘speed’] . “</u> KMPH</h2>”;

echo “<h2>Humidity is :<u>” . $data[‘main’][‘humidity’] . “</u> %</h2>”;

 

echo  “<h2>Weather condition:<u>” . $data[‘weather’][0][‘main’]  . “</u>”;

 

echo “<img src=’http://openweathermap.org/img/w/” .$data[‘weather’][0][‘icon’]. “.png’ width=’90’ height=’90’></h2>”;

?>

You will see a form and when you will enter name of any city in the Input field and hit enter your application will get the data from following JSON:

In this example we have checked our URL with “Lucknow”.

This is a pretty json output:

{
  "coord": {
    "lon": 80.92,
    "lat": 26.85
  },
  "weather": [
    {
      "id": 721,
      "main": "Haze",
      "description": "haze",
      "icon": "50d"
    }
  ],
  "base": "stations",
  "main": {
    "temp": 40,
    "pressure": 1005,
    "humidity": 16,
    "temp_min": 40,
    "temp_max": 40
  },
  "visibility": 3000,
  "wind": {
    "speed": 1
  },
  "clouds": {
    "all": 0
  },
  "dt": 1492077600,
  "sys": {
    "type": 1,
    "id": 7817,
    "message": 0.0125,
    "country": "IN",
    "sunrise": 1492042451,
    "sunset": 1492088381
  },
  "id": 1264733,
  "name": "Lucknow",
  "cod": 200
}

You can see Live Demo at this URL : http://weather.slidescope.com

 

BySlide Scope

Codeigniter training in Lucknow

Codeigniter Training is for Web Developers with knowledge of core / basic php and Object Oriented Programming concepts.

What is Codeigniter ?

Codeigniter is a PHP framework for developing Web Applications quickly and more professionally. It is used by millions of developers across the globe.

Why Codeigniter ?

  • Codeigniter is Open Source.
  • It is light weight.
  • It used very Less resources on the server.
  • Documentation of Codeigniter on it’s official website is easy to understand and very strong.
  • Codeigniter is backed by a large community of Users. Help topics, tutorials and good trainers are easily available.
  • Many organizations are using Codeigniter and looking for professionals with sound knowledge of Codeigniter.

Who can do Codeigniter Training ?

People with knowledge of Basic / Core PHP and Object Oriented Programming Concepts can learn Codeigniter easily.

Candidates who want to build a career in web development (using PHP) can learn Codeigniter.

Where to Learn Codeigniter ?

  • You can learn codeigniter in Online and Classroom training module by Escalera Technologies.
  • You will learn everything from scratch.
  • You will work on live projects while learning.
  • You will learn database management – like done in large enterprises.

 

BySlide Scope

Lucknow Php Training Institute Core Php Advanced Php

Php is an open source Server Side Scripting Language used by many web developers and companies to develop basic and advanced web applications. You can learn Php to create fast web applications and you don’t need to pay any amount to install and setup the tools that are required to learn Php because it is opens source.

Many free tools are available to run and test php scripts on your Personal Computer or Laptop.

If you are familiar with Java Coding or C#(Sharp) coding then understanding Php will not be difficult for you.

If you are fairly new to the world of coding then also you can learn creating applications in php in 2 to 3 months.

There are various tutorials, books and articles available on internet which can help you in learning Php on your own.

If you are familiar with the basics of programming, learning online will not be difficult for you but Guidance of a professional trainer is always important because a trainer will explain you things practically and you will get experience of working on the Live Projects. A trainer can explain you the core concepts in detail.

We are associated with Escalera.tech which is a great institute with 10 + years of computer languages coaching experience .

You can learn Core and Advanced Php from Escalera Technologies with working experience on Live projects.

A complete training with Database Management and Database Logic on MySql with complete understanding of  Business Logic.

Learn Documentation of Small, Medium and Large Scale projects.

Learn advanced usage of Roles, Sessions, Cookies etc.

Learn Advanced Php using frameworks like Codeigniter.

Learn creating frameworks based on Model View Controller

Fill this Simple Form to Contact us : http://slidescope.com/contact-us/