Пример #1
0
 /**
  * @param string $url
  * @return string $jsonString
  */
 private function fetchWithCacheFrom($url)
 {
     return $this->curler->fetch($url);
 }
Пример #2
0
 function tweet($msg)
 {
     require dirname(__FILE__) . "/Curler.php";
     $curler = new Curler();
     $curler->post(self::API_URL_STATUS, array("status" => $msg), $this->credentials);
 }
Пример #3
0
 /**
  * Make the actual http request using Curl
  * 
  * @TODO ensure proper form for params going to curler_instance()->make_request
  * 
  * @param string $http_method (one of GET|POST|PUT|DELETE|HEAD|OPTIONS)
  * @param string|null $entity_body
  * @return Response
  */
 protected function make_http_request($http_method, $entity_body = null)
 {
     $http_response = Curler::make_request($http_method, $this->attributes['uri'], $this->curl_opts, $this->attributes['entity_headers'], $entity_body);
     return new Response($http_response['response'], Curler::response_has_headers(), $http_response['info']);
 }
Пример #4
0
         foreach ($html->find('title') as $value) {
             $title = $value->plaintext;
         }
     }
     if ($image == "null") {
         $tempimg = 'http://www.google.com/s2/favicons?domain=www.' . "{$domain_name}";
         $image[] = $tempimg;
         $image = json_encode($image);
     }
     if ($description == "null") {
         $description = "[]";
     }
     break;
 default:
     // curling
     $curler = new Curler();
     $body = $curler->get($url);
     $parser = new MetaParser($body, $url);
     $meta_detail = $parser->getDetails();
     $meta_detail['openGraph']['image'];
     $image[] = $meta_detail['openGraph']['image'];
     $image = json_encode($image);
     if ($image == "null" || $image == "") {
         $tempimg = 'http://www.google.com/s2/favicons?domain=www.' . "{$domain_name}";
         $image[] = $tempimg;
         $image = json_encode($image);
     }
     foreach ($html->find('title') as $value) {
         $title = $value->plaintext;
     }
     $description = "[]";