0

The following address is of a form : https://webservices.ignou.ac.in/GradecardM/

This form is asp.net driven and its method is set to post.

I need to fill and submit this form by using my website which is programmed in php. To carry out the operation, I created a form but it is not working. When I fill and submit my form it just open the link mentioned above instead of return result of the form.

The code of my form is mention below :

<!DOCTYPE html>
<html>
<head>
<title>Grade Card :: BCA</title>
</head>
<body>
<form method="post" action="https://webservices.ignou.ac.in/GradecardM/Result.asp">
<select name='Program'>
<option value=''>---Select Program---</option>
<option value='BCA'>BCA</option>
<option value='MCA'>MCA</option>
<option value='MP'>MP</option>
<option value='MPB'>MPB</option>
</select>
Enter Enrolment Number: <input type=text name=eno maxlength=9 size=9>
<input type="submit"      value="submit" name="submit">
</body>
</html>

How to fix the problem?

Alexander O'Mara
  • 58,688
  • 18
  • 163
  • 171

2 Answers2

0

In this case you must use cURL to do it

What is cURL in PHP

<?php
    function _curl($url,$post="",$usecookie = false,$_sock = false,$timeout = false) {  
        $ch = curl_init();
        if($post) {
            curl_setopt($ch, CURLOPT_POST ,1);
            curl_setopt ($ch, CURLOPT_POSTFIELDS, $post);
        }
        if($timeout){
            curl_setopt($ch, CURLOPT_TIMEOUT,$timeout);
            curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
        }
        if($_sock){
                curl_setopt($ch, CURLOPT_PROXY, $_sock);
                curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
        }
        curl_setopt($ch, CURLOPT_URL, $url); 
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.10) Gecko/20100914 Firefox/3.6.10"); 
        if ($usecookie) { 
            curl_setopt($ch, CURLOPT_COOKIEJAR, $usecookie); 
            curl_setopt($ch, CURLOPT_COOKIEFILE, $usecookie);    
        }
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); 
        $result=curl_exec ($ch); 
        curl_close ($ch); 
        return $result; 
    }
    $url="https://webservices.ignou.ac.in/GradecardM/Result.asp";
    $post = "Program=BCA&eno=2422&submit=Submit&hidden_submit=OK";
    $result = _curl($url,$post,'','','');
    echo $result;
?>

And result

enter image description here

Community
  • 1
  • 1
Quynh Nguyen
  • 2,959
  • 2
  • 13
  • 27
0

Or you can use this code

<!DOCTYPE html>
<html>
<head>
<title>Grade Card :: BCA</title>
</head>
<body>
<form method="post" action="https://webservices.ignou.ac.in/GradecardM/Result.asp">
<select name='Program'>
<option value=''>---Select Program---</option>
<option value='BCA'>BCA</option>
<option value='MCA'>MCA</option>
<option value='MP'>MP</option>
<option value='MPB'>MPB</option>
</select>
Enter Enrolment Number: <input type=text name=eno maxlength=9 size=9>
<input type=hidden value='OK' name=hidden_submit>
<input type="submit"      value="submit" name="submit">
</body>
</html>

You missing hidden field xD

Quynh Nguyen
  • 2,959
  • 2
  • 13
  • 27