using System.Collections.Specialized;
public string name {get;set;}
public string id {get;set;}
public string no {get;set;}
public static void Main()
Check(new Book(){ name="Top945", id="273902", no="390" });
Check(new Book(){ name="科學少年", id="300120", no="57" });
Check(new Book(){ name="少年牛頓", id="273912", no="181" });
Check(new Book(){ name="未來少年", id="274477", no="106" });
Console.WriteLine("Done @"+DateTime.Now.ToString());
private static void Check(Book book){
string url = "https://webpac.hcml.gov.tw/webpac/modules/WPSJReleaseListAjaxPage.do";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.ContentType = "application/x-www-form-urlencoded";
NameValueCollection postParams = HttpUtility.ParseQueryString(string.Empty);
postParams.Add("id", book.id);
postParams.Add("YNum", book.no);
byte[] byteArray = Encoding.UTF8.GetBytes(postParams.ToString());
using (Stream reqStream = request.GetRequestStream())
reqStream.Write(byteArray, 0, byteArray.Length);
using (WebResponse response = request.GetResponse())
using (StreamReader sr = new StreamReader(response.GetResponseStream(),Encoding.UTF8))
responseStr = sr.ReadToEnd();
if(responseStr.IndexOf("value=\"預約\"")>0) {
Console.WriteLine(string.Format("{0} no. {1} is orderable! url=>https://webpac.hcml.gov.tw/webpac/bookDetail.jsp?id={2}", book.name, book.no, book.id));