Skip to content

Instantly share code, notes, and snippets.

@chgeuer
Created June 25, 2012 19:00
Show Gist options
  • Save chgeuer/2990535 to your computer and use it in GitHub Desktop.
Save chgeuer/2990535 to your computer and use it in GitHub Desktop.
Prüfen, ob mein Personalausweis da ist...
using System;
using System.Collections.Generic;
using System.Net.Http;
namespace CardStatus
{
class Program
{
static void RunCheck(int antragsnummer)
{
// Create client
var client = new HttpClient();
// Create HTML form data
var content = new FormUrlEncodedContent(new Dictionary<string, string>
{
{ "COMMAND", "CHECK" },
{ "Nr", antragsnummer.ToString() }
});
// Submit request and get response asynchronously
var response = client.PostAsync("http://duesseldorf.dokument-abholen.de/index.php", content);
// Check whether we got an OK response
if (response.Result.IsSuccessStatusCode)
{
// Read response data asynchronously
var result = response.Result.Content.ReadAsStringAsync();
if (result.Result.Contains("leider noch nicht"))
{
Console.WriteLine("Grmpf... Leider noch nicht da");
}
else
{
Console.WriteLine("Yippie ... Perso holen gehen...");
}
}
else
{
Console.WriteLine("Could not download data");
}
}
static void Main(string[] args)
{
RunCheck(12345);
Console.ReadLine();
}
}
}
/*
POST http://duesseldorf.dokument-abholen.de/index.php HTTP/1.1
Host: duesseldorf.dokument-abholen.de
Referer: http://duesseldorf.dokument-abholen.de/
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
Content-Length: 27
COMMAND=CHECK&Nr=3449024354
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment