stormsearchers Posted August 16, 2016 Share Posted August 16, 2016 Fatal error: Call to undefined function: json_decode() in C:\Users\Michael Wright\xampp\htdocs\stormsearchers\req\weatherinfo.php on line 7 Hello I am getting Error code i was wounding if someone can help out please to fix the problem <?php $QueryState = $_GET['state']; $QueryCity = str_replace(' ', '_', $_GET['city']); $string = file_get_contents("http://api.wunderground.com/api/You're key gose Here/conditions/q/" . $QueryState . "/" . $QueryCity . ".json"); $json_a = json_decode($string,true); // <---------- Current Conditions ----------> // //Display Location $location_full = $json_a['current_observation']['display_location']['full']; $location_city = $json_a['current_observation']['display_location']['city']; $location_state = $json_a['current_observation']['display_location']['state']; $location_state_name = $json_a['current_observation']['display_location']['state_name']; $location_country = $json_a['current_observation']['display_location']['country']; $location_zip = $json_a['current_observation']['display_location']['zip']; $location_latitude = $json_a['current_observation']['display_location']['latitude']; $location_longitude = $json_a['current_observation']['display_location']['longitude']; $location_elevation = $json_a['current_observation']['display_location']['elevation']; //Observation Location $observation_location_full = $json_a['current_observation']['observation_location']['full']; $observation_location_city = $json_a['current_observation']['observation_location']['city']; $observation_location_state = $json_a['current_observation']['observation_location']['state']; $observation_location_country = $json_a['current_observation']['observation_location']['country']; $observation_location_latitude = $json_a['current_observation']['observation_location']['latitude']; $observation_location_longitude = $json_a['current_observation']['observation_location']['longitude']; $observation_location_elevation = $json_a['current_observation']['observation_location']['elevation']; //Station Data $current_station_id = $json_a['current_observation']['station_id']; $current_observation_time = $json_a['current_observation']['observation_time']; $current_observation_time = $json_a['current_observation']['observation_time']; //Weather Data $weather = $json_a['current_observation']['weather']; $weather_temperature_string = $json_a['current_observation']['temperature_string']; $weather_temp_f = $json_a['current_observation']['temp_f']; $weather_temp_c = $json_a['current_observation']['temp_c']; $weather_relative_humidity = $json_a['current_observation']['relative_humidity']; $weather_wind_string = $json_a['current_observation']['wind_string']; $weather_wind_dir = $json_a['current_observation']['wind_dir']; $weather_wind_degrees = $json_a['current_observation']['wind_degrees']; $weather_wind_mph = $json_a['current_observation']['wind_mph']; $weather_wind_gust_mph = $json_a['current_observation']['wind_gust_mph']; $weather_wind_kph = $json_a['current_observation']['wind_kph']; $weather_wind_gust_kph = $json_a['current_observation']['wind_gust_kph']; $weather_pressure_mb = $json_a['current_observation']['pressure_mb']; $weather_pressure_in = $json_a['current_observation']['pressure_in']; $weather_pressure_trend = $json_a['current_observation']['pressure_trend']; $weather_dewpoint_string = $json_a['current_observation']['dewpoint_string']; $weather_dewpoint_f = $json_a['current_observation']['dewpoint_f']; $weather_dewpoint_c = $json_a['current_observation']['dewpoint_c']; $weather_heat_index_string = $json_a['current_observation']['heat_index_string']; $weather_heat_index_f = $json_a['current_observation']['heat_index_f']; $weather_heat_index_c = $json_a['current_observation']['heat_index_c']; $weather_windchill_string = $json_a['current_observation']['windchill_string']; $weather_windchill_f = $json_a['current_observation']['windchill_f']; $weather_windchill_c = $json_a['current_observation']['windchill_c']; $weather_feelslike_string = $json_a['current_observation']['feelslike_string']; $weather_feelslike_f = $json_a['current_observation']['feelslike_f']; $weather_feelslike_c = $json_a['current_observation']['feelslike_c']; $weather_visibility_mi = $json_a['current_observation']['visibility_mi']; $weather_visibility_km = $json_a['current_observation']['visibility_km']; $weather_solarradiation = $json_a['current_observation']['solarradiation']; $weather_UV = $json_a['current_observation']['UV']; $weather_precip_1hr_string = $json_a['current_observation']['precip_1hr_string']; $weather_precip_1hr_in = $json_a['current_observation']['precip_1hr_in']; $weather_precip_1hr_metric = $json_a['current_observation']['precip_1hr_metric']; $weather_precip_today_string = $json_a['current_observation']['precip_today_string']; $weather_precip_today_in = $json_a['current_observation']['precip_today_in']; $weather_precip_today_metric = $json_a['current_observation']['precip_today_metric']; $weather_icon = $json_a['current_observation']['icon']; $weather_icon_url = $json_a['current_observation']['icon_url']; // <---------- End Current Conditions ----------> // I have taken my api key so no one can use it i have setup a testing server using Xmap but when i uploadto file i am also getting this message Started: 8/16/2016 10:04 AM .idea\.name - same - not transferred .idea\encodings.xml - same - not transferred .idea\misc.xml - same - not transferred .idea\modules.xml - same - not transferred .idea\scopes\scope_settings.xml - same - not transferred .idea\vcs.xml - same - not transferred .idea\Weather API.iml - same - not transferred .idea\workspace.xml - same - not transferred css\bootstrap-responsive.css - same - not transferred css\bootstrap-responsive.min.css - same - not transferred css\bootstrap.css - same - not transferred css\bootstrap.min.css - same - not transferred images\binary.gif - same - not transferred images\folder.GIF - same - not transferred images\image.gif - same - not transferred images\movie.gif - same - not transferred images\sound.gif - same - not transferred images\text.gif - same - not transferred img\glyphicons-halflings-white.png - same - not transferred img\glyphicons-halflings.png - same - not transferred index.php - same - not transferred js\bootstrap.js - same - not transferred js\bootstrap.min.js - same - not transferred req\geo.php - same - not transferred req\geoplugin.class.php - same - not transferred req\weatherinfo.php - same - not transferred File activity complete. Files skipped: 26 Finished: 8/16/2016 10:04 AM have i done some think wrong many thanks for the help Link to comment Share on other sites More sharing options...
dsonesuk Posted August 16, 2016 Share Posted August 16, 2016 Have you used json_decode() successfully before? No! Is json exstension enabeled in php.ini? Requires server restart. Link to comment Share on other sites More sharing options...
stormsearchers Posted August 16, 2016 Author Share Posted August 16, 2016 how can i enabled in the php.ini file Link to comment Share on other sites More sharing options...
dsonesuk Posted August 16, 2016 Share Posted August 16, 2016 https://alephnull.uk/content/how-fix-jsondecode-php-0 Link to comment Share on other sites More sharing options...
stormsearchers Posted August 16, 2016 Author Share Posted August 16, 2016 Sorry i have looked but there is no such file in the php.ini for me to delete it (;extension=json.so ) Link to comment Share on other sites More sharing options...
dsonesuk Posted August 16, 2016 Share Posted August 16, 2016 You do not delete it! You remove semi-colon ‘;‘, and are you sure you have correct php.ini file there can be more than one, look at php phpinfo file for configuration on location of php.ini used. Link to comment Share on other sites More sharing options...
stormsearchers Posted August 16, 2016 Author Share Posted August 16, 2016 this is the Windows Extensions can not see it there ;Windows Extensions ;Note that ODBC support is built in, so no dll is needed for it. ; ;extension=php_adt.dll ;extension=php_apd.dll ;extension=php_bcompiler.dll ;extension=php_blenc.dll ;extension=php_bz2.dll ;extension=php_bz2_filter.dll ;extension=php_classkit.dll ;extension=php_cpdf.dll ;extension=php_crack.dll ;extension=php_curl.dll ;extension=php_cvsclient.dll ;extension=php_date.dll ;extension=php_db.dll ;extension=php_dba.dll extension=php_dbase.dll extension=php_dbx.dll extension=php_dio.dll ;extension=php_domxml.dll ;extension=php_event.dll ;extension=php_fdf.dll ;extension=php_ffi.dll extension=php_filepro.dll ;extension=php_fribidi.dll extension=php_gd2.dll ;extension=php_gettext.dll ;extension=php_gopher.dll ;extension=php_http.dll ;extension=php_hyperwave.dll ;extension=php_ibm_db2.dll ;extension=php_id3.dll ;extension=php_ifx.dll ;extension=php_iisfunc.dll ;extension=php_imagick.dll ;extension=php_imap.dll ;extension=php_interbase.dll ;extension=php_java.dll ;extension=php_ldap.dll ;extension=php_lzf.dll ;extension=php_mailparse.dll ;extension=php_maxdb.dll extension=php_mbstring.dll extension=php_exif.dll ;extension=php_mcrypt.dll ;extension=php_memcache.dll ;extension=php_mhash.dll extension=php_mime_magic.dll extension=php_ming.dll extension=php_msql.dll extension=php_mssql.dll extension=php_mysql.dll extension=php_mysqli.dll ;extension=php_netools.dll ;extension=php_ntuser.dll ;extension=php_oci8.dll ;extension=php_oggvorbis.dll extension=php_openssl.dll ;extension=php_oracle.dll ;extension=php_parsekit.dll extension=php_pdf.dll ;extension=php_pdo.dll ;extension=php_pdo_firebird.dll ;extension=php_pdo_mssql.dll ;extension=php_pdo_mysql.dll ;extension=php_pdo_oci.dll ;extension=php_pdo_oci8.dll ;extension=php_pdo_odbc.dll ;extension=php_pdo_pgsql.dll ;extension=php_pdo_sqlite.dll ;extension=php_perl.dll ;extension=php_pgsql.dll ;extension=php_phpdoc.dll ;extension=php_pop3.dll ;extension=php_printer.dll ;extension=php_pspell.dll ;extension=php_radius.dll ;extension=php_rar.dll ;extension=php_runkit.dll extension=php_shmop.dll ;extension=php_smtp.dll ;extension=php_snmp.dll extension=php_soap.dll extension=php_sockets.dll ;extension=php_ssh2.dll ;extension=php_stats.dll ;extension=php_sybase_ct.dll ;extension=php_threads.dll ;extension=php_tidy.dll ;extension=php_translit.dll ;extension=php_win32scheduler.dll ;extension=php_win32service.dll ;extension=php_win32std.dll ;extension=php_xdebug.dll ;extension=php_xmlreader.dll ;extension=php_xmlrpc.dll ;extension=php_xmlwriter.dll ;extension=php_xsl.dll ;extension=php_yaz.dll extension=php_zip.dll ;extension=php_zlib_filter.dll Link to comment Share on other sites More sharing options...
stormsearchers Posted August 16, 2016 Author Share Posted August 16, 2016 i'm happy to do a login me for help but can not find the ini mate Link to comment Share on other sites More sharing options...
justsomeguy Posted August 16, 2016 Share Posted August 16, 2016 That extension is built in to PHP 5.2 and later, so you probably need to upgrade your PHP version. The current version is 7. Link to comment Share on other sites More sharing options...
stormsearchers Posted August 16, 2016 Author Share Posted August 16, 2016 How can i do an upgrade for the php 7 mike all ew to this stuff sorry for asking so many questions Link to comment Share on other sites More sharing options...
justsomeguy Posted August 16, 2016 Share Posted August 16, 2016 The manual has an entire section on installation, based on which web server you're using: http://php.net/manual/en/install.php You can probably also find packages like XAMPP or WAMP (depending on your OS) which have it bundled. Link to comment Share on other sites More sharing options...
stormsearchers Posted August 16, 2016 Author Share Posted August 16, 2016 I'm using widows hoping to do up another partition as it's just stalled on my C: drive atm cause i wish to have my own server to run my web site save paying for it i also want to create a www folder for my folders and buy domianname and have that link to my server if any body can help that will be great as i don't get much money these days Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now