if (isset($_GET['url'])) {
    $crawler = new crawler();
    if ($crawler->fetchWebpage($_GET['url'])) {
        //Fetchs the webpage.
        $xml->fetch = "true";
        $xml->url = "http://" . preg_replace('/^http[s]?:(\\/)(\\/)/', "", $_GET['url']);
        $domain = parse_url("http://" . preg_replace('/^http[s]?:(\\/)(\\/)/', "", $_GET['url']));
        $xml->domain = $domain['host'];
        $xml->path = preg_replace('/(\\/)[a-zA-z0-9\\.]+$/', "", preg_replace('/(\\/)$/', "", $domain['path']));
        $xml->path = preg_replace('/(\\/([a-z0-9])+)(\\/\\.\\.)$/i', "", $xml->path);
        $crawler->fetchLinks($xml);
        //Fetchs all the links.
        $xml->links->addAttribute('count', count($xml->links[0]));
        $xml->out->addAttribute('count', count($xml->out[0]));
        unset($xml->out->link);
        $crawler->indexableData($xml);
        //Fetchs data for indexing.
        $xml->words->addAttribute('count', count($xml->words[0]));
    } else {
        $xml->fetch = "failed";
    }
}
print $xml->asXML();
class crawler
{
    private $funcs;
    private $mysql;
    private $file;
    function __construct()
    {
        require_once "../classes/funcs.php";