예제 #1
0
 /**
  * @param $feedUrl
  */
 public function saveFeed($feedUrl)
 {
     $curl = new \anlutro\cURL\cURL();
     $request = $curl->newRequest('get', $feedUrl)->setOption(CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.2; WOW64; rv:17.0) Gecko/20100101 Firefox/17.0');
     $response = $request->send();
     file_put_contents($this->feedUrl, $response->body);
 }
예제 #2
0
 /**
  * Execute the job.
  *
  */
 public function handle()
 {
     if (Cache::has($this->cache_key())) {
         return Cache::get($this->cache_key());
     }
     $curl = new \anlutro\cURL\cURL();
     $params = ['key' => env('GOOGLE_MAP_SERVER_KEY'), 'address' => $this->location];
     $url = 'https://maps.googleapis.com/maps/api/geocode/json?' . http_build_query($params);
     $response = $curl->get($url);
     $data = json_decode($response->body);
     Cache::forever($this->cache_key(), $data);
     return Cache::get($this->cache_key());
 }
예제 #3
0
 /**
  * Execute the job.
  *
  */
 public function handle()
 {
     if (Cache::has($this->cache_key())) {
         return Cache::get($this->cache_key());
     }
     $curl = new \anlutro\cURL\cURL();
     $params = ['key' => env('GOOGLE_MAP_SERVER_KEY'), 'input' => $this->location, 'language' => 'pt-BR', 'region' => 'br', 'types' => '(cities)', 'components' => 'country:BR', 'sensor' => 'false'];
     $url = 'https://maps.googleapis.com/maps/api/place/autocomplete/json?' . http_build_query($params);
     $response = $curl->get($url);
     $data = json_decode($response->body);
     Cache::forever($this->cache_key(), $data);
     return Cache::get($this->cache_key());
 }
예제 #4
0
 private function curl()
 {
     $curl = new \anlutro\cURL\cURL();
     switch (true) {
         case preg_match('/post/i', $this->getRequest()):
             return $curl->newRequest('post', $this->getUrl(), ['payload' => json_encode(json_decode($this->getData(), true))])->setHeaders($this->getHeaders())->send()->body;
         case preg_match('/get/i', $this->getRequest()):
             return $curl->newRequest('get', $this->getUrl(), [])->setHeaders($this->getHeaders())->send()->body;
         default:
             return $curl->newRequest($this->getRequest(), $this->getUrl(), [])->setHeaders($this->getHeaders())->send()->body;
     }
 }
예제 #5
0
 /**
  * Send email from contact form
  *
  * @return void
  */
 protected function sendContactUsForm()
 {
     //info@hapjesenco.be
     //$contactFormData = $data;
     $amount = Input::json('personCount');
     $menuRaw = Input::json('selected_menu');
     $menuDecoded = base64_decode($menuRaw);
     $menuObj = json_decode($menuDecoded);
     $drinks = '';
     if (property_exists($menuObj, 'drinks') && property_exists($menuObj->drinks, 'selected') && $menuObj->drinks->selected == true) {
         $from = '';
         $to = '';
         if (property_exists($menuObj->drinks, 'from')) {
             $from = $menuObj->drinks->from;
         }
         if (property_exists($menuObj->drinks, 'to')) {
             $to = $menuObj->drinks->to;
         }
         $drinks = "\n\nGraag ook een offerte voor all-in drankenservice van " . $from . "u tot " . $to . "u. ";
     }
     $data = array('deliveryType' => 'bezorgen', 'hostname' => 'hapjesenco', 'firstname' => Input::json('firstname'), 'surname' => Input::json('lastname'), 'street' => Input::json('street'), 'number' => Input::json('housenumber'), 'postcode' => Input::json('zipcode'), 'city' => Input::json('city'), 'country' => Input::json('country'), 'companyName' => Input::json('companyName'), 'deliveryName' => Input::json('deliveryName'), 'VATnumber' => Input::json('VATnumber'), 'email' => Input::json('email'), 'phone' => Input::json('telephone'), 'orderDate' => convertDate(Input::json('date'), Input::json('time')), 'orderDateTime' => Input::json('time'), 'orderComment' => Input::json('multiText') . $drinks, 'product id' => Input::json('productId'), 'orderType' => 'estimate');
     $shoppingCart = $this->createShoppingCart($menuObj);
     $data['shoppingCart'] = $shoppingCart;
     $curl = new anlutro\cURL\cURL();
     $person_url = "http://beheer.cateringsoftware.nl/public/persons";
     $order_url = "http://beheer.cateringsoftware.nl/public/orders";
     $response = $curl->post($person_url, $data);
     $person_id = json_decode($response->body);
     $data['Person_id'] = $person_id->Person_id;
     $data['StoreFront_id'] = '1';
     $responseOrder = $curl->post($order_url, $data);
     $user = array('email' => '*****@*****.**', 'name' => 'Fingerfoodtruck');
     /*Mail::send('emails.contact', $data, function($message) use ($user)
     		{	
     			$message->from('*****@*****.**', 'Laravel');
     			$message->to($user['email'], $user['name'])->subject('Offerte aanvraag Fingerfoodtruck');
     			return 'success';
     		});*/
 }
예제 #6
0
 protected function guardAgainstInsufficientBitcoinBalance($address)
 {
     /**
      * Uses Blockchain.info
      * (Hardcoded for now.)
      */
     $curl = new \anlutro\cURL\cURL();
     $response = $curl->get("https://blockchain.info/q/addressbalance/{$address}?confirmations=0");
     /**
      * Returns false if the
      * funds are sufficient
      */
     if ($response->body > 0.0001) {
         return false;
     }
     /**
      * We have a problem.
      */
     return true;
 }
예제 #7
0
 public function set_current()
 {
     $curl = new anlutro\cURL\cURL();
     $response = json_decode($curl->get('http://api.openweathermap.org/data/2.5/weather?units=metric&lat=' . $this->lat . '&lon=' . $this->lng . '&APPID=6cfd180eeb2bd61dbaf2be616d347544')->body);
     $this->windspeed = $response->wind->speed;
     $this->temperature = number_format($response->main->temp);
     $this->ride = false;
     $this->weather_detailed = $response->weather[0]->description;
     $this->location = $response->name;
     $rideweather = false;
     switch (strtolower($response->weather[0]->description)) {
         case 'thunderstorm with light rain':
         case 'thunderstorm with rain':
         case 'thunderstorm with heavy rain':
         case 'light thunderstorm':
         case 'thunderstorm':
         case 'heavy thunderstorm':
         case 'ragged thunderstorm':
         case 'thunderstorm with light drizzle':
         case 'thunderstorm with drizzle':
         case 'thunderstorm with heavy drizzle':
         case 'moderate rain':
         case 'heavy intensity rain':
         case 'very heavy rain':
         case 'extreme rain':
         case 'freezing rain':
         case 'shower rain':
         case 'heavy intensity shower rain':
         case 'ragged shower rain':
         case 'light snow':
         case 'snow':
         case 'heavy snow':
         case 'sleet':
         case 'shower sleet':
         case 'light rain and snow':
         case 'rain and snow':
         case 'light shower snow':
         case 'shower snow':
         case 'heavy shower snow':
         case 'tornado':
         case 'tropical storm':
         case 'hurricane':
         case 'sand/Dust Whirls':
         case 'fog':
         case 'sand':
         case 'dust':
         case 'VOLCANIC ASH':
         case 'SQUALLS':
         case 'TORNADO':
         case 'windy':
         case 'hail':
         case 'drizzle':
         case 'heavy intensity drizzle':
         case 'drizzle rain':
         case 'heavy intensity drizzle rain':
         case 'shower rain and drizzle':
         case 'heavy shower rain and drizzle':
         case 'shower drizzle':
         case 'light intensity drizzle rain':
         case 'light intensity drizzle':
         case 'light intensity shower rain':
         case 'light rain':
             $this->weather = 'bad';
             $this->descriptive = 'bad';
             $rideweather = 'bad';
             break;
         case 'sky is clear':
         case 'few clouds':
         case 'scattered clouds':
         case 'broken clouds':
         case 'overcast clouds':
             $this->weather = 'good';
             $rideweather = 'good';
             $this->descriptive = 'good';
             break;
         case 'mist':
         case 'smoke':
         case 'haze':
             $this->weather = 'maybe';
             $rideweather = 'maybe';
             $this->descriptive = 'maybe';
             break;
     }
     if ($this->temperature > 14 && $rideweather === 'good') {
         $this->ride = 'good';
     } elseif ($this->temperature > 10 && ($rideweather === 'maybe' || $rideweather === 'good')) {
         $this->ride = 'maybe';
     } else {
         $this->ride = 'bad';
     }
 }
예제 #8
0
 public static function get_by_str($str)
 {
     $curl = new anlutro\cURL\cURL();
     $response = json_decode($curl->get('http://nominatim.openstreetmap.org/search?accept-language=en-gb&addressdetails=1&limit=4&format=json&q=' . urlencode($str)));
     return $response;
 }