Example #1
0
 static function GetMethod($method, $url, $args = array())
 {
     global $langmessage;
     //arguments
     $defaults = array('method' => 'GET', 'timeout' => 5, 'redirection' => 5, 'httpversion' => '1.0', 'user-agent' => 'Mozilla/5.0 (gpEasy RemoteGet) ');
     $args += $defaults;
     //check url
     $url = str_replace(' ', '%20', $url);
     //spaces in the url can make the request fail
     if (parse_url($url) === false) {
         return false;
     }
     //decide how to get
     switch ($method) {
         /*
         			case 'http_request':
         			return gpRemoteGet::http_request($url,$args);
         */
         case 'stream':
             return gpRemoteGet::stream_request($url, $args);
         case 'fopen':
             return gpRemoteGet::fopen_request($url, $args);
         case 'fsockopen':
             return gpRemoteGet::fsockopen_request($url, $args);
         default:
             //message($langmessage['OOPS']);
             return false;
     }
 }