Last active
          August 29, 2015 14:07 
        
      - 
      
 - 
        
Save saaiful/5b028841702a0b3c033f to your computer and use it in GitHub Desktop.  
    Def. All Result
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <?php | |
| ini_set('xdebug.var_display_max_depth', 5); | |
| ini_set('xdebug.var_display_max_children', 256); | |
| ini_set('xdebug.var_display_max_data', 1024); | |
| function get_result($data){ | |
| static $all = array(); | |
| $data = str_replace(array(" ","\n","\r",' ',' ',' '), '', $data); | |
| // echo '<textarea>'. $data .'</textarea>'; | |
| $pr[] = '<td width[a-zA-Z0-9=" ]+>([A-Za-z0-9 - ]+)<\/td>'; | |
| $pr[] = '<td width[a-zA-Z0-9=" ]+>([A-Za-z0-9-: ,]+)<\/td>'; | |
| $pr[] = '<td width[a-zA-Z0-9=" :]+>([A-Za-z0-9 .-]+)<\/td>'; | |
| $pr[] = '*\s+<td width[a-zA-Z0-9=" ]+>([A-Za-z0-9 .+-]+)<\/td>'; | |
| $pr[] = '<td width[a-zA-Z0-9=" ]+>([A-Za-z0-9 .+-]+)<\/td>'; | |
| $pr = implode("", $pr); | |
| preg_match_all("/$pr/", $data, $match); | |
| // var_dump($match); | |
| $x = $temp = ''; | |
| for ($i=0; $i < count($match[0]); $i++) | |
| { | |
| $temp['code'] = $match[1][$i]; | |
| $temp['subject'] = $match[2][$i]; | |
| $temp['credit'] = $match[3][$i]; | |
| $temp['grade'] = $match[4][$i]; | |
| $temp['gp'] = $match[5][$i]; | |
| $all[] = $temp; | |
| } | |
| return $all; | |
| } | |
| $post['STUDENT_ID'] = '111-15-1248'; | |
| $sem = 11; | |
| $sem_12 = 1; | |
| $r = substr($post['STUDENT_ID'],0,2); | |
| $s = substr($post['STUDENT_ID'],2,1); | |
| $ch = curl_init(); | |
| curl_setopt($ch, CURLOPT_USERAGENT, ' Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:30.0) Gecko/20100101 Firefox/30.0'); | |
| curl_setopt($ch, CURLOPT_COOKIEJAR, __DIR__.'/cookies.txt'); | |
| curl_setopt($ch, CURLOPT_COOKIEFILE, __DIR__.'/cookies.txt'); | |
| curl_setopt($ch, CURLOPT_AUTOREFERER, false); | |
| curl_setopt($ch, CURLOPT_COOKIESESSION, true); | |
| curl_setopt($ch, CURLOPT_POST, true); | |
| curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
| curl_setopt($ch, CURLOPT_URL, 'http://vus.daffodilvarsity.edu.bd/?app=result'); | |
| for ($i=1; $i <= 12 ; $i++) | |
| { | |
| $post['SELESTER_ID'] = "{$r}{$s}"; | |
| $s += 1; | |
| if($s>3) | |
| { | |
| $s = 1; | |
| $r += 1; | |
| } | |
| curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($post)); | |
| $result = curl_exec($ch); | |
| $all = get_result($result); | |
| } | |
| curl_close($ch); | |
| var_dump($all); | |
| ?> | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment