Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function get($url, $includeHeader=false) {
- $urlp = parse_url($url);
- $fp = fsockopen($urlp['host'],80);
- $path = explode('/',$url,4);
- $path = ((count($path)>=4)?$path[3]:"");
- $req = "GET /$path HTTP/1.1\r\n";
- $req .= "Host: $urlp[2`host]\r\n";
- $req .= "Connection: Close\r\n\r\n";
- fputs($fp, $req);
- $res = "";
- while(!feof($fp)) $res .= fgets($fp, 4096);
- fclose($fp);
- if($includeHeader) return $res;
- $res = explode("\r\n\r\n",$res,2);
- return $res[1];
- }
- /**
- * A utility function to get all text beween $start and $end
- * @param $content The content from which we are grabbing data
- * @param $start where to start grabbing from
- * @param $end the end of the content to grab
- */
- function getBetween($content,$start,$end){
- $r = explode($start, $content);
- if (isset($r[1])){
- $r = explode($end, $r[1]);
- return $r[0];
- }
- return '';
- }
- }
- }
- } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement