We have created a complete PHP script that you can use and include on your webpages.
PHP is a programming language common in many publishing systems (such as WordPress and Joomla). Many servers support PHP.
How to do it
- You must have a server with PHP version 5 or newer. If you have PHP version 4 and want to upgrade, contact your hosting provider.
- Download the script (zip file) and extract the files to a folder on the machine, or use Git.
- Edit the file yr.php with a text editor (such as Notepad). There are instructions in the top of the file that you have to read carefully.
- Use an FTP application and upload the file to your server (contact your hosting provider if you need help).
- Go to http: //www.yourdomain/yr.php. Here you will see the forecast.
You can also copy the PHP code into yr.php and paste it into another page (included in your design). Make sure you change the settings in yr.php accordingly.
You may want to change the script if you know PHP, but remember that you must follow the guidelines for using data from yr.no (among other things you have to include a visible link to yr.no on your page).
Good luck!
Remember to always use the latest version of the script!
The script was first released on April 30th, 2008, and last modified on September 2nd, 2015. You should always upgrade to the latest version!
Important!
- If we make changes to yr.no that impact PHP forecasts, we will in most cases send you an e-mail if you register on the list (about six emails per year). Fill in your name and e-mail in the form to the right.
- Read the terms for using data from yr.no.
- Unfortunately yr.no can not provide support or help you implement the PHP script on your web pages. If you can not get the script to work, you need to get help from someone who knows PHP or simple server management.
- If you further develop the script (removes any errors or add new features), yr.no will gladly share what you have done with other users! If you would like to share what you have done with others, send an email to yr (at) met.no.
Credits
- The first version of the script was made by Øyvind Skau, anubix.net. The script is later developed and improved by Lennart André Rolland in NRK.
- The script is inspired by XML Parser Class / Eric Rosebrock, phpfreaks.com.
- The classes are originally from kris@h3x.com, devdump.com/phpxml.php