Downloading entire lists using PHP

I was viewing this site http://kmu.edu.pk/content.php?link=mbbs3rdprof_08_search. The results are from roll number 4300-4500. The site only displays result of one roll number

Is there any way (e.g, using some Regular Expressions etc) one can download entire lists than just one result.

anyone !!!

I am afraid you can not do that just writing any thing special (ie. reg exp.) in that text field.

but if you are good in any language then you can write your own code to fetch and parse the results out of the website you provided or any other website.

I am not going to refer any object or function from any language.

consider the following parameters

1-you can only use the above solution if the host website is not restricting the referrer URLs (specifically if the problem deals with the form submission as in your case)

2-you can not do it easily if the roll numbers are not in a specific sequence order. or you can arrange a prepared roll number list to pass over to the website programatically.

there are also other techniques if you have any experience you can guess that.

well its not possible.The result you see, is server side processed information :D

i guess you have heard about Internet bots. which could do this for you :D (bots, are software applications that run automated tasks over the Internet.)

Of course this is possible with PHP. You need to send a post request. Use this function:

http://netevil.org/blog/2006/nov/http-post-from-php-without-curl

Like this:

<?php


// roll numbers 4305 to 4308 inclusive


for($i=4305;$i<=4308;$i++)

{


$raw_data=array("Roll_Number"=>$i);

$data=http_build_query($raw_data);


$rep=do_post_request("http://kmu.edu.pk/content.php?link=mbbs3rdprof_08",$data);

//extract results table

$snip=stristr($rep,"
"); $end=strpos($snip,"
"); //seperate lines $snippet=explode(" ",substr($snip,0,$end+8)); $resultline=$snippet[sizeof($snippet)-3]; //strip html $result=trim(strip_tags ($resultline)); echo $i."=".$result." "; } function do_post_request($url, $data, $optional_headers = null) { $params = array('http' => array( 'method' => 'POST', 'content' => $data )); if ($optional_headers !== null) { $params['http']['header'] = $optional_headers; } $ctx = stream_context_create($params); $fp = @fopen($url, 'rb', false, $ctx); if (!$fp) { throw new Exception("Problem with $url, $php_errormsg"); } $response = @stream_get_contents($fp); if ($response === false) { throw new Exception("Problem reading data from $url, $php_errormsg"); } return $response; }