Esempio n. 1
0
if (!$con) {
    die('Could not connect: ' . mysql_error());
}
mysql_select_db("", $con);
require_once '../lib/CurlHandler.class.php';
require_once '../lib/simple_html_dom.php';
//$uni_url=$_POST['code'];
// Mathematics Department :: Find the other urls using firebug (depID)!
//echo $uni_url."<br/>";
//$url=http://81.31.167.195:8081/edu/newLessonList/newLessonsList.jsp?depID=$uni_code;
//echo "URL=......................".$url;
//$mycurl=new CurlHandler("http://81.31.167.195:8081/edu/newLessonList/newLessonsList.jsp?depID=40");
$mycurl = new CurlHandler($_POST[code]);
//$mycurl->readCookie();
$post_data = array("depID" => "25", "hashMapParametersValue" => "null");
$mycurl->postData($post_data);
$out = $mycurl->execute();
$mycurl->close();
// page content
//echo $out;
// Root object
$dom = str_get_html($out);
// Finding tables!
$tables = $dom->find('table[class=contentTable]');
//clear table
$table = "course";
mysql_query("TRUNCATE {$table}");
foreach ($tables as $table) {
    //$tr=$table->first_child()->children[2];
    $tr = $table->children[2];
    while ($tr != null) {