View Single Post
  #6 (permalink)  
Old 01-26-2008, 10:19 AM
bbrian017 bbrian017 is offline
Banned
 
Join Date: Oct 2007
Location: Canada
Posts: 914
Thanks: 169
Thanked 17 Times in 17 Posts
Also when I added the code and tried to add a url that was already submitted I get the following error in the header, This might also happen when you submit a new url but I didn't have a new url to submit and try !

Thanks so much for helping me with this! It's greatly appreciates!

Code:
fp = fsockopen(($this->_protocol == 'https' ? 'tls://' : '') . $this->_host, $this->_port, $errno, $errstr, 20); if(!$this->_fp) {return("BADURL");} fwrite($this->_fp, $req); while(is_resource($this->_fp) && $this->_fp && !feof($this->_fp)) $response .= fread($this->_fp, 1024); fclose($this->_fp); // split header and body $pos = strpos($response, $crlf . $crlf); if($pos === false) return($response); $header = substr($response, 0, $pos); $body = substr($response, $pos + 2 * strlen($crlf)); // parse headers $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)); // redirection? if(isset($headers['location'])) { $http = new HTTPRequest($headers['location']); return($http->DownloadToString($http)); } else { return($body); } } } ?>
Attached Files
File Type: php link.php (33.8 KB, 21 views)
Reply With Quote