Results 1 to 3 of 3

Thread: [RESOLVED] Test for simplexml_load_file() support?

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2004
    Posts
    121

    Resolved [RESOLVED] Test for simplexml_load_file() support?

    Code:
    /* INITIALIZE THE XML FILE */
    	$xml_file=@simplexml_load_file('path/to/my/file.txt');
    /* PERFORM AN ERROR TEST */
    	if($xml_file) {
    		/* LOOP THROUGH THE XML */
    			foreach($xml_file->xml_tag AS $tag) {
    				/* THE ARRAY */
    					// here i fill the array elements
    				/* INCREMENT THE VARIABLE */
    					$i+=1;
    			}
    	} else {
    		// my alternate code
    		// parse it another way...
    	}
    Hello all.
    Is there a way of determining whether or not a server supports simplexml, and if it does not, then go to my alternate code?
    Thanks in advance.
    Last edited by solitario; Jan 11th, 2008 at 09:22 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width