我的大学成绩卡(结果)很难理解,而且很难计算学生的实际百分比。所以,我想为学生提供一项服务,学生只需要在那里输入注册号。我会自己计算结果。
首先,我尝试向 http://hurl.it 中的成绩卡页面发送帖子请求这 是烫发链接http://hurl.it/hurls/c61f1d38b6543965151a1c8a8d6f641b8921da49/986ecba51b61022fa9fa162be612d7c928051989
但是从我的网站使用 jquery 发送相同的请求时出现错误:我正在使用以下代码发送请求。
$.ajax({
type: "POST",
url: "http://stusupport12.ignou.ac.in/Result.asp",
data: "submit=Submit&eno=092853268&hidden%5Fsubmit=OK&Program=BCA",
success: function (d) {
$("#resultDiv").html(d);
},
error: function (a, b, c) { alert(a + b + c); }
});
请朋友们帮帮我。
更新 2 - 我通过在我的服务器上处理请求来找到我的解决方案。我创建了一个通用处理程序 (.ashx) 来处理服务器上的请求并将处理后的请求发送回客户端。我可以用 Jquery 来调用它。
这是代码
<%@ WebHandler Language="C#" Class="IGNOU" %>
using System;
using System.Web;
using Newtonsoft.Json;
using System.Collections.Generic;
using System.Net;
using System.IO;
public class IGNOU : IHttpHandler {
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "text/html";
context.Response.Write(Func(context.Request.QueryString["eno"]));
}
public bool IsReusable {
get {
return false;
}
}
public string Func(string eno)
{
string str = string.Empty;
WebRequest request = WebRequest.Create("http://stusupport12.ignou.ac.in/Result.asp");
// Set the Method property of the request to POST.
request.Method = "POST";
// Create POST data and convert it to a byte array.
string postData = "submit=Submit&Program=BCA&hidden_submit=OK&eno=" + eno;
byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(postData);
// Set the ContentType property of the WebRequest.
request.ContentType = "application/x-www-form-urlencoded";
// Set the ContentLength property of the WebRequest.
request.ContentLength = byteArray.Length;
// Get the request stream.
Stream dataStream = request.GetRequestStream();
// Write the data to the request stream.
dataStream.Write(byteArray, 0, byteArray.Length);
// Close the Stream object.
dataStream.Close();
// Get the response.
WebResponse response = request.GetResponse();
// Display the status.
Console.WriteLine(((HttpWebResponse)response).StatusDescription);
// Get the stream containing content returned by the server.
dataStream = response.GetResponseStream();
// Open the stream using a StreamReader for easy access.
StreamReader reader = new StreamReader(dataStream);
// Read the content.
string responseFromServer = reader.ReadToEnd();
// Display the content.
Console.WriteLine(responseFromServer);
// Clean up the streams.
reader.Close();
dataStream.Close();
response.Close();
return responseFromServer;
}
}
更新 1添加了网页链接 https://www.bobdn.com/IGNOU_BCA_Result.aspx