View Single Post
Old February 15th, 2008, 2:11 PM   #2 (permalink)
Mark
Surpass Developer
On a golden path...
 
Mark's Avatar
 
Joined in Jan 2004
Lives in Florida
Hosted on decc.surpasshosting.com
396 posts
Gave thanks: 10
Thanked 68 times
Replace this

PHP Code:
$xml_parser xml_parser_create();
xml_set_element_handler($xml_parser"startElement""endElement");
xml_set_character_data_handler($xml_parser"characterData");
if (!(
$fp fopen($file"r"))) {
    die(
"could not open XML input");
}

while (
$data fread($fp4096)) {
    if (!
xml_parse($xml_parser$datafeof($fp))) {
        die(
sprintf("XML error: %s at line %d",
                    
xml_error_string(xml_get_error_code($xml_parser)),
                    
xml_get_current_line_number($xml_parser)));
    }

with this

PHP Code:
$xml_parser xml_parser_create();
xml_set_element_handler($xml_parser"startElement""endElement");
xml_set_character_data_handler($xml_parser"characterData");

$ch curl_init();
curl_setopt($chCURLOPT_URL$file);
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
$xmldata curl_exec($ch);
curl_close($ch);

$xmldata split("\n",$xmldata);

foreach (
$xmldata as $data) {
    if (!
xml_parse($xml_parser$data)) {
        die(
sprintf("XML error: %s at line %d",
                    
xml_error_string(xml_get_error_code($xml_parser)),
                    
xml_get_current_line_number($xml_parser)));
    }

I *think* that should work, but i'm not totally sure because I haven't done too much php+xml
__________________
Mark
Surpass Hosting Developer
sɹnoʎ uɐɥʇ ɹǝʇʇǝq sı bıs ʎɯ
Mark is offline   Reply With Quote
This user thanks Mark for this great post!
steelwidow (February 16th, 2008)