public static function parseLinks($url = "http://zingstudios.com", $render = "TXT") { try { $page = new csm\WebPage($url); $page->loadContent(); $page->parseLinks(); //LinkScraper::renderTxt($page); if ($render == "TXT") { LinkScraper::renderTXT($page); return; } if ($render == "JSON") { LinkScraper::renderJSON($page); return; } print_r($page->getLinks()); } catch (csm\net\UrlException $e) { print $e; } }
<?php define("APP_ROOT", dirname(__FILE__)); require_once APP_ROOT . "/lib/Util.php"; require_once APP_ROOT . "/lib/CloudshadowMedia.php"; require_once APP_ROOT . "/lib/Net.php"; require_once APP_ROOT . "/lib/WebPage.php"; require_once APP_ROOT . "/lib/Parser.php"; require_once APP_ROOT . "/lib/Json.php"; require_once APP_ROOT . "/lib/ILinkVisitor.php"; require_once APP_ROOT . "/lib/Newsletter.php"; require_once APP_ROOT . "/lib/LinkScraper.php"; //LinkScraper::parseLinks("http://zingstudios.com", "JSON"); LinkScraper::parseLinks("http://zingstudios.com", "TXT"); //LinkScraper::parseLinks("http://cnn.com", "TXT"); //LinkScraper::parseLinks("http://news.yahoo.com", "TXT"); //NewsLetter::getValidSubscribers();