remote::get PHP Method

get() public method

public get ( $url, $data = [], $format = false, $options = [] )
    function get($url, $data = array(), $format = false, $options = array())
    {
        $query = http_build_query($data);
        $url = url::has_query($url) ? $url . '&' . $query : $url . '?' . $query;
        $response = self::request($url, false, $options);
        $content = a::get($response, 'content');
        if (error($response)) {
            return $response;
        }
        if (empty($content)) {
            return false;
        }
        if ($format) {
            return self::parse($content, $format);
        }
        return $content;
    }

Usage Example

Example #1
0
 public function __construct($xml)
 {
     if (str::is_path($xml)) {
         if (str::is_url($xml)) {
             $r = remote::get($xml);
             $this->data = $r['content'];
         } else {
             $this->data = file_get_contents($xml);
         }
     } else {
         $this->data = $xml;
     }
     if (empty($this->data)) {
         return false;
     }
     unset($xml, $r, $fp);
 }
All Usage Examples Of remote::get