Questions about this topic? Sign up to ask in the talk tab.

Difference between revisions of "Projects:Overview"

From NetSec
Jump to: navigation, search
m (moved Projects to Projects:Overview: Namespace change to allow for only trusted members and up to view/edit.)
(No difference)

Revision as of 09:18, 27 December 2010

Current Projects

XML Parser Class

 
<?PHP
// Zach - [email protected]
// Requires: PHP5, cURL, SimpleXML
 
$a = new XMLParser('http://www.google.com/sitemap.xml') or die("Invalid XML Data");
 
class XMLParser {
 
  public  $xmldata;
  private $url = '';
 
  public function __construct($strURL = '') {
    $this->url = (strlen($strURL) ? $strURL : FALSE);
    $this->xmldata = ($this->url ? $this->getXML($this->url) : FALSE);
    return $this->xmldata;
  }
 
  public function getXML($xURL) {
    $ch = curl_init($xURL);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    $localXML = simplexml_load_string(curl_exec($ch));
    curl_close($ch);
    return $localXML;
  }
}