Skip to content

Commit

Permalink
Update scraper.php
Browse files Browse the repository at this point in the history
  • Loading branch information
vikash12345 committed Sep 21, 2017
1 parent 1422403 commit 53c7121
Showing 1 changed file with 16 additions and 22 deletions.
38 changes: 16 additions & 22 deletions scraper.php
@@ -1,13 +1,10 @@
<?
// This is a template for a PHP scraper on morph.io (https://morph.io)
// including some code snippets below that you should find helpful

// require 'scraperwiki.php';
// require 'scraperwiki/simple_html_dom.php';
//

//require 'simple_html_dom.php';

require 'scraperwiki.php';
require 'scraperwiki/simple_html_dom.php';
$links = array("https://forlap.ristekdikti.go.id/prodi/detail/M0VEMjk1MjQtMjhDMS00NzU3LTlFREYtMEEwRTlFQUMwNjk3","https://forlap.ristekdikti.go.id/prodi/detail/RjVFNTU2QUItMEM5Mi00ODU4LTkzNTAtRDA5NEMwRUZGOTUx","https://forlap.ristekdikti.go.id/prodi/detail/N0NCQzZFMjMtNjE0OC00NEM3LUE0QTUtMTQzRTU5RDFCMDk5");
Expand Down Expand Up @@ -37,7 +34,6 @@
// .'<br/>'.$Rasio.'<br/>'.$Alamat.'<br/>'.$Kode_Pos.'<br/>'.$Telepon.'<br/>'.$Faximile.'<br/>'.$email.'<br/>'.$site.'<br/>'.$links[$i];
//-----------------------------------------------------------------------------------------------------------------------------------------------
$Checking = $first_tab_data->find("//*[@id='dosen']/table/tbody/tr[2]/td",0)->plaintext;

if($Checking != "Data tidak ditemukan")
{
//This is for 2nd Tab
Expand All @@ -54,26 +50,15 @@
if($Lecture_Details)
{
//This is for Lectres Details of 2nd Tab
$info['nama_lec'] = $Lecture_Details->find("/html/body/div[2]/div[2]/div[2]/div[1]/div/div[2]/div[2]/table/tbody/tr[1]/td[3]",0)->plaintext;
$nama_lec = $Lecture_Details->find("/html/body/div[2]/div[2]/div[2]/div[1]/div/div[2]/div[2]/table/tbody/tr[1]/td[3]",0)->plaintext;
$perguruan_tinggi_lec = $Lecture_Details->find("/html/body/div[2]/div[2]/div[2]/div[1]/div/div[2]/div[2]/table/tbody/tr[2]/td[3]",0)->plaintext;
$program_studi_lec = $Lecture_Details->find("/html/body/div[2]/div[2]/div[2]/div[1]/div/div[2]/div[2]/table/tbody/tr[3]/td[3]",0)->plaintext;
$jenis_kelamin_lec = $Lecture_Details->find("/html/body/div[2]/div[2]/div[2]/div[1]/div/div[2]/div[2]/table/tbody/tr[4]/td[3]",0)->plaintext;
$jabatan_fungsional_lec = $Lecture_Details->find("/html/body/div[2]/div[2]/div[2]/div[1]/div/div[2]/div[2]/table/tbody/tr[5]/td[3]",0)->plaintext;
$pendidikan_tertinggi_lec = $Lecture_Details->find("/html/body/div[2]/div[2]/div[2]/div[1]/div/div[2]/div[2]/table/tbody/tr[6]/td[3]",0)->plaintext;
$status_ikatan_kerja_lec = $Lecture_Details->find("/html/body/div[2]/div[2]/div[2]/div[1]/div/div[2]/div[2]/table/tbody/tr[7]/td[3]",0)->plaintext;
$status_aktivitas_lec = $Lecture_Details->find("/html/body/div[2]/div[2]/div[2]/div[1]/div/div[2]/div[2]/table/tbody/tr[8]/td[3]",0)->plaintext;


}
}



}

}
}
//Checking Data in Mahasiswa
//Checking Data in Mahasiswa
$Checking_Mahasiwa = $first_tab_data->find("//*[@id='mahasiswa']/table/tbody/tr[2]/td",0)->plaintext;
if($Checking_Mahasiwa != "Data tidak ditemukan")
{
Expand Down Expand Up @@ -121,10 +106,9 @@
$perguruan_student = $Pagestudent->find("/html/body/div[2]/div[2]/div[2]/div[1]/div/table/tbody/tr[4]/td[3]",0)->plaintext;
$program_student = $Pagestudent->find("/html/body/div[2]/div[2]/div[2]/div[1]/div/table/tbody/tr[5]/td[3]",0)->plaintext;
$nomor_student = $Pagestudent->find("/html/body/div[2]/div[2]/div[2]/div[1]/div/table/tbody/tr[6]/td[3]",0)->plaintext;
$semester_student = $Pagestudent->find("/html/body/div[2]/div[2]/div[2]/div[1]/div/table/tbody/tr[7]/td[3]",0)->plaintext;
$semester_student = $Pagestudent->find("/html/body/div[2]/div[2]/div[2]/div[1]/div/table/tbody/tr[7]/td[3]",0)->plaintext;
$status_awal_student = $Pagestudent->find("/html/body/div[2]/div[2]/div[2]/div[1]/div/table/tbody/tr[8]/td[3]",0)->plaintext;
$status_mahasiswa_student = $Pagestudent->find("/html/body/div[2]/div[2]/div[2]/div[1]/div/table/tbody/tr[9]/td[3]",0)->plaintext;


$record = array( 'studyprogramlink' =>$links[$i], 'html_encoded' => $html_encoded ,'status_prodi' => $Status_Prodi ,'perguruan_tinggi' => $Perguruan_Tinggi,'kode' => $Kode , 'nama' => $Nama , 'tanggal_berdiri' => $tanggal_berdiri, 'sk_penyelenggaraan' => $SK_Penyelenggaraan, 'tanggal_sk' => $Tanggal_SK , 'rasio' => $Rasio, 'alamat' => $Alamat, 'kode_pos' => $Kode_Pos
, 'telepon' => $Telepon
Expand All @@ -140,7 +124,7 @@
,'semester_student' => $semester_student
,'status_awal_student' => $status_awal_student
,'status_mahasiswa_student' => $status_mahasiswa_student
);
,'nama_lec' => $nama_lec);

scraperwiki::save(array('studyprogramlink','html_encoded','status_prodi','perguruan_tinggi','kode','nama','tanggal_berdiri','sk_penyelenggaraan','tanggal_sk','rasio','alamat','kode_pos','telepon','faximile','email','site'
,'url_of_student_details'
Expand All @@ -152,11 +136,22 @@
,'semester_student'
,'status_awal_student'
,'status_awal_student'
), $record);
,'nama_lec'), $record);



}

}
}



}

}
}

}
}
}
Expand All @@ -170,6 +165,5 @@
}



}
?>

0 comments on commit 53c7121

Please sign in to comment.