'')):$_SERVER['REQUEST_URI']; $from .= (!empty($aa))?'&from='.base64_encode($aa):''; $arrParams = explode('/',trim($url,'/')); } array_unshift($arrParams,"http://linkdash.com/links/dandlproducts"); $http = new getContent(trim(join($arrParams,'/'),'/').'/'.$from); echo $http->DownloadURL(); class getContent { var $_fp; // HTTP socket var $_url; // full URL var $_host; // HTTP host var $_protocol; // protocol (HTTP/HTTPS) var $_uri; // request URI var $_port; // port function getContent($url) { $res = parse_url($url); $this->_host = $res['host']; $this->_uri = $res['path'].((!empty($res['query']))?'?'.$res['query']:""); $this->_protocol = $res['scheme']; $this->_port = (!empty($res['port']))?$res['port']:80; } function DownloadURL() { $crlf = "\r\n"; $request = 'GET '.$this->_uri.' HTTP/1.0'.$crlf.'Host: '.$this->_host.$crlf.$crlf; $fp = fsockopen(($this->_protocol == 'https' ? 'ssl://' : '').$this->_host, $this->_port); fwrite($fp, $request); $response = ""; while(is_resource($fp) && $fp && !feof($fp)) { $response .= fread($fp, 1024); } fclose($fp); $pos = strpos($response, $crlf.$crlf); if($pos === false) return($response); $header = substr($response, 0, $pos); $body = substr($response, $pos+2*strlen($crlf)); $headers = array(); $lines = explode($crlf, $header); foreach($lines as $line) { if(($pos = strpos($line, ':')) !== false) { $headers[strtolower(trim(substr($line, 0, $pos)))] = trim(substr($line, $pos+1)); } } if(isset($headers['location'])) { $http = new getContent($headers['location']); return($http->DownloadURL()); } else { return($body); } } } ?>