From 4cc1ce2dbf27377a22d7190ffb90eb4000313185 Mon Sep 17 00:00:00 2001 From: Underrateddev Date: Thu, 5 Oct 2017 16:38:02 -0700 Subject: [PATCH] Updated Plane model to use curl rather than file_get_contents --- application/models/Plane.php | 16 +++++++++++++--- changelog.md | 4 ++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/application/models/Plane.php b/application/models/Plane.php index eccb8d1..c356115 100644 --- a/application/models/Plane.php +++ b/application/models/Plane.php @@ -13,10 +13,20 @@ public function __construct () { // Returns all planes from json format from server public function all () { - $page = "http://wacky.jlparry.com/info/airplanes"; - $json_planes = file_get_contents ($page); + + $ch = curl_init(); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_URL, 'http://wacky.jlparry.com/info/airplanes'); + $result = curl_exec($ch); + curl_close($ch); + + // $page = "http://wacky.jlparry.com/info/airplanes"; + // $json_planes = file_get_contents ($page); - return $json_planes; + // return $json_planes; + + return $result; } } diff --git a/changelog.md b/changelog.md index 77515bc..85d5f4d 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [Unreleased] - YR +### Changed +- Updated Planes Model to use Curl as fopen is not enabled with url + ## [Unreleased] - YR ### Added - Planes Model