open from url extra
Brought to you by:
bs_php,
nigelswinson
From: <php...@li...> - 2001-10-22 00:40:27
|
One more addition to that last code...append a "@" to the beginning of the implode call when it is a url to suppress php warnings...since the xpath warning will be outputted anyway... Oh, and if you want to do a socket connection...check out the code from the rdf php class...which you can find at http://www.fase4.com/rdf/ I also put a snippet of the code below.... if ( $this->_use_proxy == true ) { // we need a raw socket here to connect to proxy $fp = fsockopen($this->_phost,$this->_pport); if (!$fp) $this->_throw_exception( $this->_remote_file." is not available with proxy" ); else { if ( $this->_use_proxy_auth == true ) fputs($fp, "GET ".$this->_remote_file." HTTP/1.0\r\n\r\n"); else fputs($fp, "GET ".$this->_remote_file." HTTP/1.0\r\nProxy-Authorization: Basic ".base64_encode("$this->_pname:$this->_ppasswd") ."\r\n\r\n"); } for ( $i = 0; !feof ($fp) ; $i++) { $usable_data[$i] = ""; $usable_data[$i] = fgets($fp,4096); // strstr did not fit (ask Rasmus why), so we compare each character if ( ($usable_data[$i][0] == "<" ) && ($usable_data[$i][1] == "?" ) && ($usable_data[$i][2] == "x" ) && ($usable_data[$i][3] == "m" ) && ($usable_data[$i][4] == "l" ) ) { $usable_data[0] = $usable_data[$i]; // save current field $i = 1; // just reset array to start } // there seems to be a "date" after the <?xml....we just delete this if ( ($usable_data[$i][0] == "<" ) && ($usable_data[$i][1] == "r" ) && ($usable_data[$i][2] == "d" ) && ($usable_data[$i][3] == "f" ) && ($usable_data[$i][4] == ":" ) ) { $usable_data[1] = $usable_data[$i]; // save current field $i = 2; // just reset array to start } } fclose($fp); return $usable_data; } Dan ------------------------------------------------------- __________________________________________________ Do You Yahoo!? Make a great connection at Yahoo! Personals. http://personals.yahoo.com |