Jump to content

To fetch the form exam results from an external website displaying on my website


punith

Recommended Posts

hii'm new to php but i tried to make my own edu website but i'm facing lot of problem bu using phpwhen the students enter their usn no(eg:1db11cs001) when user hit submit button it must fetch result from external website(eg:fastvturesults,vtualerts) and it must display result on my website

i'm new to php so plz help me by giving complete codei got this from some website but it's not working properly

<?phpecho '<form action="' . $_SERVER[PHP_SELF] . '" method="post"><input type="text" name="rid"><input type="submit" name="submit" value="submit"></form>';if(isset($_POST['submit'])&&(!empty($_…{$location = 'http://results.vtu.ac.in/vitavi.php';$userAgent = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)';$ch = curl_init();curl_setopt($ch, CURLOPT_HEADER, 0);curl_setopt($ch, CURLOPT_VERBOSE, 0);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);curl_setopt($ch, CURLOPT_POST, 1);curl_setopt($ch, CURLOPT_URL, $location );$post_array = array("rid" => $_POST['rid'],"submit" => "submit");curl_setopt($ch, CURLOPT_POSTFIELDS, $post_array);$response = curl_exec($ch);$start = '<TD width="513">';$end = '<br>';$response = strstr($response, $start);$end = stripos($response, $end);$response = substr($response, strlen($start), $end - strlen($start));echo $response."<br/>";}?>
Edited by punith
Link to comment
Share on other sites

what's the problem? what's happening? what debugging are you doing? How do you know what the code is doing and where it breaks?

Link to comment
Share on other sites

@ thescientist

while explainig the problem i hv left out some lines now i've completed it

 

coming to problem topic

i haev copied & pasted the code on online php complier (http://phpfiddle.org/) when i enter usn no/roll no(eg:1db13cs005) its just showing the student name but i need the complete result copy to be displayed on my website

Link to comment
Share on other sites

what's your updated code? What exactly are you getting for a response? It's hard to help you without seeing what you're doing. debug everything, especially $response.

 

I would personally proxy curl through your localhost and using something like Charles Web Proxy to monitor the request and response so you can see exactly what is going on.

Edited by thescientist
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...