示例#1
0
 /**
  * Makes a request to the TriMet API
  * 
  * @return array an array of arrival information from TriMet
  */
 public function getApiResponse()
 {
     $requestURL = $this->getApiUrl($this->stop);
     $response = Curl::get($requestURL);
     $response_array = json_decode($response, true);
     return $response_array['resultSet'];
 }
示例#2
0
 public function get()
 {
     if ($this->video_id) {
         try {
             // If value exists in cache ve just return it
             $content = \Cache::get(\Inflector::friendly_title($this->video_id));
             return $content;
         } catch (\CacheNotFoundException $e) {
             // Value not in cache
             $request = \App\Curl::forge();
             $request->cUrl(false);
             $response = $request->get($this->url['first_part'] . $this->video_id . $this->url['second_part']);
             if ($array = $request->is_json($response, true)) {
                 $return = array('id' => $this->video_id, 'link' => $array->entry->link[0]->href, 'title' => $array->entry->title->{'$t'}, 'description' => $array->entry->{'media$group'}->{'media$description'}->{'$t'}, 'duration' => $array->entry->{'media$group'}->{'media$content'}[0]->duration, 'thumbnail' => array('small' => $array->entry->{'media$group'}->{'media$thumbnail'}[0]->url, 'middle' => $array->entry->{'media$group'}->{'media$thumbnail'}[1]->url, 'large' => $array->entry->{'media$group'}->{'media$thumbnail'}[2]->url));
                 // Save value in cache for future use
                 \Cache::set(\Inflector::friendly_title($this->video_id), $return, 3600 * 24);
                 return $return;
             }
         }
     }
     return false;
 }
示例#3
0
 /**
  * Constructor
  *
  * @param array $conf key and login prameters
  */
 public function __construct(array $conf)
 {
     parent::__construct();
     $this->_data = $conf;
 }
示例#4
0
 protected function getExecute($code, $assoc = false)
 {
     $curl = new Curl('execute', ['code' => $code], [], null, $assoc);
     return $assoc ? $curl->all()['response'] : $curl->all()->response;
 }
示例#5
0
 public function getStats($acc = 1602483811)
 {
     $curl = new Curl('ads.getFloodStats', ['account_id' => $acc]);
     dd($curl->all()->response);
 }
示例#6
0
            <div class="content">
                <div class="title">CommutePop</div>
                <div class="subtitle">Comming Soon to PDX</div>
                <h1 class="summary">Live transit times.<br>Right in your inbox.<br>Exactly when you need them.</h1>
                <?php 
function validate()
{
    $trimmed_email_address = trim($_POST["email"]);
    $email_address = filter_var($trimmed_email_address, FILTER_SANITIZE_EMAIL);
    return filter_var($email_address, FILTER_VALIDATE_EMAIL);
}
if ($_SERVER["REQUEST_METHOD"] == "POST" && validate() == TRUE) {
    //mailchimp
    $postFields = '{"email_address":"' . $_POST['email'] . '","status":"pending"}';
    $header = 'Authorization: apikey ' . $mailchimpKey;
    $response = Curl::postJSON($listURL, $postFields, $header);
    ?>
                    <div class="share">
                        <p>Thanks! We'll be in touch.</p><p>Have friends who might be interested?</p>
                        <ul class="social-nav model-2">
                          <li><a href="https://twitter.com/share" class="twitter" data-url="http://leaveat.com" data-text="Coming soon: #TriMet email alerts for commuters." data-via="gregkaleka">t<i class="fa fa-twitter"></i></a></li>
                          <li><a href="#" class="facebook">f<i class="fa fa-facebook"></i></a></li>
                          <li><a href="#" class="google-plus">g+<i class="fa fa-google-plus"></i></a></li>
                          <li><a href="#" class="linkedin">li<i class="fa fa-linkedin"></i></a></li>
                        </ul>
                        <br/>
                    </div>
                    <?php 
} else {
    ?>
                        <h3 class="beta">Interested in becoming a beta tester?</h3>