hi
i'm new to php but i tried to make my own edu website but i'm facing lot of problem bu using php
when the students enter their usn no(eg:1db12cs005) when user hit submit button it must fetch result from external website(eg:http://www.results.vtu.ac.in/) but I don't want to redirected to the external website, where results can be seen. Instead, I want the results to be displayed on the same website. I'm open to to all kinds of suggestion!
i'm new to php so plz help me by giving complete code
i got this from some website but it's not working properly.when the student enter their usn no and when they hit submit button its just accessing their name but its not showing their marks and also it's showing its result in sidebar i want to display in new windows(their r many website for eg fastvturesults.com,vtualerts they fetch from website http://www.results.vtu.ac.in/ )
<?php
echo '<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($_POST['rid'])))
{
$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/>";
}
?>