file = $this->getCURL($url); } if(CONNECTION == 'http'){ $this->file = $this->getHTTP($url); } if(CONNECTION == 'socket'){ $this->file = $this->getSOCKET($url); } } function getCURL($url){ $ch = curl_init ($url); // curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1); if(CONNECTION_PROXY != ""){ curl_setopt($ch, CURLOPT_PROXY,CONNECTION_PROXY.":".CONNECTION_PORT); } if(CONNECTION_PASSWORD != ""){ curl_setopt ($ch, CURLOPT_PROXYUSERPWD, CONNECTION_USER.':'.CONNECTION_PASSWORD); } curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); $file = curl_exec ($ch); curl_close ($ch); return $file; } function getHTTP($url){ return file_get_contents($url); } function getSOCKET($url){ $r = ""; $fp = fsockopen (CONNECTION_PROXY, CONNECTION_PORT, $errno, $errstr, 30); if (!$fp) { echo "$errstr ($errno)
\n"; } else { fputs ($fp, "GET ".$url." HTTP/1.0\r\n\r\n"); while (!feof($fp)) { $r .= fgets($fp,4096); } fclose($fp); return $r; } } } ?>