ここで 2 つの問題があります。だから私はあなたの助けが必要です。
microsoft.com の応答コードの結果は、HTTP/1.1 403 Forbidden または HTTP/1.1 200 OK です。
try { IdHTTP->Get("http://www.microsoft.com"); ListBox->Items->Add(IdHTTP->Response->ResponseCode); } catch (const EIdException &E) { ListBox->Items->Add(E.Message); ListBox->Items->Add(IdHTTP->Response->ResponseText); }しかし、私がそれをチェックしたとき、
http://web-sniffer.net/またはhttp://tools.seobook.com/server-header-checkerその結果はHTTP/1.1 302 Moved Temporarily.IdHTTP からの結果が上記の両方の URL と異なるのはなぜですか?. IdHTTP はどのようにして同じ http ステータス コードを達成できますか?.
TListBox 内の EIdException / Exception の E.Message エラーを色付けして置き換えます。
たとえば、私
"Socket Error # 10061Connection refused"は"your connection is refused".ListBox->Items->Add(StringReplace(E.Message,"Socket Error # 10061Connection refused.","your connection is refused.",TReplaceFlags()<<rfReplaceAll));しかし、その方法を使用しても、結果は同じです。
これを読んでくれてありがとう。どんな助けや提案も大歓迎です!!