Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在VB.Net中重新启动PI,并停留在某些内容上_Vb.net - Fatal编程技术网

在VB.Net中重新启动PI,并停留在某些内容上

在VB.Net中重新启动PI,并停留在某些内容上,vb.net,Vb.net,我怀疑是否有人有与这项任务相关的具体经验,但也许你能发现我的问题。我正试图打电话给Limition(论坛软件)在他们的投票中投票,他们的文档显示: 示例URL: 查询参数: poll.choice(必选):-投票的选择。选项由id/choice\u id形式的字符串指定,其中choice\u id是轮询选项的id Http方法: 职位 因此,我的代码如下所示: Dim _Response As New XmlDocument Dim RestApiRoot As String = "h

我怀疑是否有人有与这项任务相关的具体经验,但也许你能发现我的问题。我正试图打电话给Limition(论坛软件)在他们的投票中投票,他们的文档显示:

示例URL:

查询参数: poll.choice(必选):-投票的选择。选项由id/choice\u id形式的字符串指定,其中choice\u id是轮询选项的id

Http方法: 职位

因此,我的代码如下所示:

Dim _Response As New XmlDocument    
Dim RestApiRoot As String = "http://example.com/community-name/restapi/vc/polls/id/6/votes/place"

APIRequest = WebRequest.Create(RestApiRoot)  
APIRequest.Method = "POST"    
APIRequest.Headers.Add("poll.choice", HttpContext.Current.Server.UrlEncode("id/" & _choiceID.ToString))

APIResponse = APIRequest.GetResponse()    
APIReader = New StreamReader(APIResponse.GetResponseStream())

_Response.LoadXml(APIReader.ReadToEnd())

APIResponse.Close()
// create the request
var request = new RestRequest();
request.Verb = Method.POST;
request.BaseUrl = "http://example.com/community-name";

// specify the action 
request.Action = "restapi/vc/polls/id/6/votes/place";

// add the parameters
request.AddParameter("poll.choice", "id/" + _choiceID.ToString());

// now create a RestClient to execute the request, 
// telling it to put the results in your "reponse" class
var client = new RestClient();
var lithiumresponse = client.Execute<LithiumResponse>(request);

// now you can check the status property of your class to 
// see if it was successful
if (lithiumresponse.status == "success")
    // you successfully placed a vote
我无法成功注册投票,他们说这是因为poll.choice参数没有出现在标题中,但如果我逐步调试,我会在标题键/项目中看到它


有人知道我可能做错了什么吗?

我就是通过开源REST框架RestSharp来做到这一点的。它与Limition REST API配合使用非常好

使用RestSharp时,您的代码将如下所示:

您将创建一个类似于Limition API的响应的类,在本例中为“response”。它将如下所示(抱歉,您必须将其转换为VB.NET):

现在RestSharp将使用它来捕获如下结果:

Dim _Response As New XmlDocument    
Dim RestApiRoot As String = "http://example.com/community-name/restapi/vc/polls/id/6/votes/place"

APIRequest = WebRequest.Create(RestApiRoot)  
APIRequest.Method = "POST"    
APIRequest.Headers.Add("poll.choice", HttpContext.Current.Server.UrlEncode("id/" & _choiceID.ToString))

APIResponse = APIRequest.GetResponse()    
APIReader = New StreamReader(APIResponse.GetResponseStream())

_Response.LoadXml(APIReader.ReadToEnd())

APIResponse.Close()
// create the request
var request = new RestRequest();
request.Verb = Method.POST;
request.BaseUrl = "http://example.com/community-name";

// specify the action 
request.Action = "restapi/vc/polls/id/6/votes/place";

// add the parameters
request.AddParameter("poll.choice", "id/" + _choiceID.ToString());

// now create a RestClient to execute the request, 
// telling it to put the results in your "reponse" class
var client = new RestClient();
var lithiumresponse = client.Execute<LithiumResponse>(request);

// now you can check the status property of your class to 
// see if it was successful
if (lithiumresponse.status == "success")
    // you successfully placed a vote
//创建请求
var request=new RestRequest();
request.Verb=Method.POST;
request.BaseUrl=”http://example.com/community-name";
//指定操作
request.Action=“restapi/vc/polls/id/6/vows/place”;
//添加参数
request.AddParameter(“poll.choice”,“id/”+_choiceID.ToString());
//现在创建一个RestClient来执行请求,
//告诉它把结果放在你的“回复”课上
var client=new RestClient();
var litiumresponse=client.Execute(请求);
//现在,您可以将类的status属性检查为
//看看是否成功
if(lizumResponse.status==“成功”)
//你成功地投了一票

我使用RestSharp与Limition API进行了大量交互,这使它变得非常简单。非常棒的库。

我正是通过开源REST框架RestSharp做到这一点的。它与Limition REST API配合使用非常好

使用RestSharp时,您的代码将如下所示:

您将创建一个类似于Limition API的响应的类,在本例中为“response”。它将如下所示(抱歉,您必须将其转换为VB.NET):

现在RestSharp将使用它来捕获如下结果:

Dim _Response As New XmlDocument    
Dim RestApiRoot As String = "http://example.com/community-name/restapi/vc/polls/id/6/votes/place"

APIRequest = WebRequest.Create(RestApiRoot)  
APIRequest.Method = "POST"    
APIRequest.Headers.Add("poll.choice", HttpContext.Current.Server.UrlEncode("id/" & _choiceID.ToString))

APIResponse = APIRequest.GetResponse()    
APIReader = New StreamReader(APIResponse.GetResponseStream())

_Response.LoadXml(APIReader.ReadToEnd())

APIResponse.Close()
// create the request
var request = new RestRequest();
request.Verb = Method.POST;
request.BaseUrl = "http://example.com/community-name";

// specify the action 
request.Action = "restapi/vc/polls/id/6/votes/place";

// add the parameters
request.AddParameter("poll.choice", "id/" + _choiceID.ToString());

// now create a RestClient to execute the request, 
// telling it to put the results in your "reponse" class
var client = new RestClient();
var lithiumresponse = client.Execute<LithiumResponse>(request);

// now you can check the status property of your class to 
// see if it was successful
if (lithiumresponse.status == "success")
    // you successfully placed a vote
//创建请求
var request=new RestRequest();
request.Verb=Method.POST;
request.BaseUrl=”http://example.com/community-name";
//指定操作
request.Action=“restapi/vc/polls/id/6/vows/place”;
//添加参数
request.AddParameter(“poll.choice”,“id/”+_choiceID.ToString());
//现在创建一个RestClient来执行请求,
//告诉它把结果放在你的“回复”课上
var client=new RestClient();
var litiumresponse=client.Execute(请求);
//现在,您可以将类的status属性检查为
//看看是否成功
if(lizumResponse.status==“成功”)
//你成功地投了一票
我使用RestSharp与Limition API进行了大量交互,这使它变得非常简单。非常棒的图书馆