I am trying to use TIdHTTP.Get to load the USPS Zip4 result web page source into a variable (to extract the 4 digit zip code suffix), e.g.,
PgSrc := IdHTTP1.Get('https://tools.usps.com/go/ZipLookupResultsAction!input.action?resultMode=0&companyName=&address1=1600+PENNSYLVANIA+AVE+NW&address2=&city=&state=Select&urbanCode=&postalCode=&zip=20500');
The above example url works fine if I paste it into any browser. However, in my code I get an EIdIOHandlerPropInvalid error with the following message «IOHandler value is not valid.»
I have many zip codes to look up, so I would appreciate any help to avoid this error or a suggestion for a different approach.
asked Jul 19, 2012 at 4:34
2
To avoid this exception you must assign the IOHandler property.
Check this sample.
{$APPTYPE CONSOLE}
{$R *.res}
uses
IdHTTP,
IdSSLOpenSSL,
SysUtils;
Var
IdHTTP1 : TIdHTTP;
Src : string;
LHandler: TIdSSLIOHandlerSocketOpenSSL;
begin
try
IdHTTP1:=TIdHTTP.Create(nil);
try
LHandler := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
try
IdHTTP1.IOHandler:=LHandler;
Src:= IdHTTP1.Get('https://tools.usps.com/go/ZipLookupResultsAction!input.action?resultMode=0&companyName=&address1=1600+PENNSYLVANIA+AVE+NW&address2=&city=&state=Select&urbanCode=&postalCode=&zip=20500');
Writeln(Src);
finally
LHandler.Free;
end;
finally
IdHTTP1.Free;
end;
except on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
Readln;
end.
Note : Also remember copy the SSL DLL (libeay32.dll, ssleay32.dll) to your system.
answered Jul 19, 2012 at 14:08
RRUZRRUZ
135k19 gold badges356 silver badges483 bronze badges
2
NastyaC12 0 / 0 / 0 Регистрация: 05.02.2020 Сообщений: 46 |
||||
1 |
||||
15.02.2020, 01:41. Показов 5010. Ответов 3 Метки нет (Все метки)
Программа компилируется, но после того как пользователь нажимает на Button1, выскакивает окно с текстом ошибки: «IOHandler value is not valid» Dll ки качала не помогло
0 |
884 / 404 / 174 Регистрация: 20.10.2016 Сообщений: 1,828 |
|
15.02.2020, 05:28 |
2 |
0 |
5 / 4 / 2 Регистрация: 20.04.2016 Сообщений: 62 |
|
15.02.2020, 07:05 |
3 |
Версия делфи? dll замени под версию индy.. Или использyй synapsе..
0 |
5537 / 4322 / 1383 Регистрация: 14.04.2014 Сообщений: 19,371 Записей в блоге: 19 |
|
18.02.2020, 08:29 |
4 |
очень рекомендую просто перейти на более современный класс THttpClient, который не связан с Indy
0 |
Форум программистов Vingrad
Модераторы: Snowy, Poseidon, MetalFan |
Поиск: |
|
Опции темы |
Akella |
|
||
Творец Профиль
Репутация: 4
|
Нужно получить контент сайтов:
В ответ: Project *****.exe raised exception class EIdIOHandlerPropInvalid with message ‘IOHandler value is not valid’. Process stopped. Use step or run to continue. Что подсунуть idHTTP в качестве IOHandler? Пробовал IdIOHandlerStream и IdIOHandlerStack — не помогает, другие ошибки вываливаются. Вот ещё в догонку. Может ошибка связана IdCompressorZLibEx. Создаю новый проект. Открываю существующий. Копирую в IdCompressorZLibEx1 из существующего. Вставляю в новый. Ошибка: class TIdCompressorZLibEx not found D2007. Indy 10.1.5 Добавлено @ 13:14 Путь прописан: $(BDS)LibIndy10 Это сообщение отредактировал(а) Akella — 18.1.2010, 13:19 |
||
|
|||
Akella |
|
||
Творец Профиль
Репутация: 4
|
C IdCompressorZLibEx разобрался. Связи с ошибкой «‘IOHandler value is not valid» нет. Щёлкнул правой кнопкой по палитре компонент. Выполнил команду reset. Дальше. Относительно IOHandler value is not valid. Ошибочка со ссылкой. На самом деле на этих страничках idHTTP спотыкается: что там может быть военного Это сообщение отредактировал(а) Akella — 18.1.2010, 16:11 |
||
|
|||
Akella |
|
||
Творец Профиль
Репутация: 4
|
Делаю простой эксперимент. |
||
|
|||
Akella |
|
||
Творец Профиль
Репутация: 4
|
Начинаю соображать. Добавлено через 5 минут и 39 секунд |
||
|
|||
Romikgy |
|
||
Любитель-программер Профиль
Репутация: 3
|
а если попробовать заюзать OnRedirect и проверять куда нужно а куда нет …. ——————— Владение русской орфографией это как владение кунг-фу — истинные мастера не применяют его без надобности. |
||
|
|||
Keeper89 |
|
||
Эксперт Профиль Репутация: 6
|
Akella, Для защищенных соединений (SSL) можно поместить компонент IdSSLIOHandlerSocket и подсунуть его в IOHandler. Плюс, что если парсить страницы для печати? На них вроде бы нет рекламы и редиректов. ——————— Cogito, ergo sum Keeper’s blog |
||
|
|||
Akella |
|
||||||||
Творец Профиль
Репутация: 4
|
Нету защищённых соединений и не хочу их использовать. или использовать «автоматически». Меня интересует ivanovo.irr.ru и протокол http, а не pronto.ru с протоколом https. Почему IdHTTP в пустом тестовом проекте нормально грузятся странички, а в проекте IdHTTP пытается лезть на другие сайты? Свойства IdHTTP одинаковые. Я однажды столкнулся с IdFtp, эта компонента тоже ни с того ни с чего начала вести себя непредсказуемо. Оказалось, что в USES попали какие-то модули не те. Добавлено через 2 минуты и 10 секунд
Добавлено через 9 минут и 24 секунды
То вываливается ошибка 302 |
||||||||
|
|||||||||
Akella |
|
||
Творец Профиль
Репутация: 4
|
Нужно подсунуть или какой-то универсальный IOHandler, или подсовывать в какой-то момент SSL IOHandler Это сообщение отредактировал(а) Akella — 18.1.2010, 22:24 |
||
|
|||
Keeper89 |
|
||
Эксперт Профиль Репутация: 6
|
Я это и предлагаю сделать
https://forums.codegear.com/thread.jspa?threadID=8692 ——————— Cogito, ergo sum Keeper’s blog |
||
|
|||
Akella |
|
||||||
Творец Профиль
Репутация: 4
|
Это я и делаю. Добавлено через 41 секунду
Добавлено через 4 минуты и 32 секунды Добавлено через 5 минут и 11 секунд
…или-или…. Добавлено через 11 минут и 54 секунды |
||||||
|
|||||||
Akella |
|
||
Творец Профиль
Репутация: 4
|
Короче, тут столько левого. создам я новую тему. |
||
|
|||
Keeper89 |
|
||
Эксперт Профиль Репутация: 6
|
Сделал тестовый проект, Indy 10.1.1. : http://slil.ru/28511360 ——————— Cogito, ergo sum Keeper’s blog |
||
|
|||
|
Правила форума «Delphi: Сети» | |
|
Запрещено: 1. Публиковать ссылки на вскрытые компоненты 2. Обсуждать взлом компонентов и делится вскрытыми компонентами
Если Вам помогли и атмосфера форума Вам понравилась, то заходите к нам чаще! С уважением, Snowy, Poseidon, MetalFan. |
0 Пользователей читают эту тему (0 Гостей и 0 Скрытых Пользователей) |
0 Пользователей: |
« Предыдущая тема | Delphi: Сети | Следующая тема » |
Solution 1:
You need the SSL library (two .DLL files) either installed in your Windows, or distributed along with your application.
Seems to be downloadable here:
https://slproweb.com/products/Win32OpenSSL.html
Or via their official web site (but I can’t find downloadable binaries there — only source code):
https://www.openssl.org/source/
Pre-compiled .DLLs for use with Indy can be downloaded here:
https://indy.fulgan.com/SSL/ (Thanks, Zed)
Solution 2:
That error means you don’t have an
-derived component attached to the
property, such as
.
After the error is raised, you can use Indy’s
function in the
unit to determine the root cause of the failure — whether the DLLs themselves could not be loaded in memory (because they were not found, etc), or because they are missing specific exports that Indy requires.
Trying to grab XML file after Google Maps Query
Question:
I’m trying to grab the XML file results after using a Google Maps API query, but my Delphi app is throwing a »
iohandler value is not valid
.» error. The «IdHTTP1.Get» line appears to be the culprit, but why?
My goal is to get the latitude and longitude coordinates from the results of the query and post them to a database. Here’s my code that’s producing the error.
procedure TViewMaps.GetXMLBtnClick(Sender: TObject);
var
lat, lng: String;
xml: IXMLDocument;
s: TStream;
begin
// Create XML File to hard disk
s := TFileStream.Create('mydata.xml', fmCreate);
try
IdHTTP1.Get('https://maps.googleapis.com/maps/api/geocode/xml?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&key=MyKey',s);
xml := TXMLDocument.Create(nil);
{xml.LoadFromXML(sName), at: xml.ChildNodes.FindNode = ('result') ChildNodes.FindNode ('formatted_address . '); }
// Load XML file for data display
XMLDocument1.LoadFromFile('mydata.xml');
XMLDocument1.Active := True;
//lat := XMLDocument1.DocumentElement;
finally
XMLDocument1.Active := False;
s.Free;
end;
end;
Solution:
The «not valid» error means an HTTPS request is being made but an SSL component has not been assigned to the
TIdHTTP.IOHandler
property, such as
TIdSSLIOHandlerSocketOpenSSL
. Also see New HTTPS functionality for
tidhttp
.
HTTPS web addresses with Indy IdHTTP in C++Builder, I believe I need to create a TIdSSLIOHandlerSocketOpenSSL component and add it to TIdHTTP as its IOHandler . When I try to do this, the code
The Handle is Invalid Windows 7 / 8 / 10
Here are 2 simple steps on how to fix the handle is invalid error on Windows.#windows
Duration: 2:15
The Handle Is Invalid Error on Windows 10 FIX [Tutorial]
If I experience this error in DISM while trying to capture an off-boot drive’s image (e.g. W:), can I
Duration: 2:54
Post problems with Indy TIdHTTP
Question:
I am having issues posting to Amazon’s SES Service using Indy’s TIdHTTP.
Here is an example of the code i am using:
procedure TMainFrm.btnAmazonSESClick(Sender: TObject);
var
SSLHandler: TIdSSLIOHandlerSocket;
HttpClient: TIdHTTP;
Params: TStringStream;
begin
SSLHandler := TIdSSLIOHandlerSocket.Create(Self);
HttpClient := TIdHTTP.Create(Self);
Params := TStringStream.create('');
try
with SSLHandler do
SSLOptions.Method := sslvSSLv3
with HttpClient do
begin
IOHandler := SSLHandler;
AllowCookies := True;
HandleRedirects := True;
HTTPOptions := [hoForceEncodeParams];
Request.ContentType := 'application/x-www-form-urlencoded';
end;
PageMemo.Text := HttpClient.Post('https://email.us-east-1.amazonaws.com?Action=VerifyEmailAddress&AWSAccessKeyId=012Some123Key46&EmailAddress=test@test%2Ecom', Params);
finally
SSLHandler.Free;
HttpClient.Free;
Params.Free;
end;
end;
Result
-
Under Indy 10.5.7 I get the error: HTTP/1.1 404 Not Found
-
Under Indy 9.0.14 I get the error: Socket
Error # 11004
Debugging Trials
-
This same demo can successfully GET the HTML from an HTTPS web page.
-
If i paste the URL above into a browser it displays the expected XML result.
I would appreciate any advice on the cause.
Solution 1:
This post is
just an incomplete wild guess
.
Maybe Remy might help you to correct it. With the following code I’m getting HTTP/1.1 400 Bad Request but I’m not wondering because the
API reference
talks about
Common Query Parameters
where is at least required the digital signature you’ll create for the request what I don’t know how to do.
I can’t test this at all because I have no account there. But I think the
procedure TForm1.Button1Click(Sender: TObject);
var
HTTPClient: TIdHTTP;
Parameters: TStrings;
SSLHandler: TIdSSLIOHandlerSocketOpenSSL;
begin
SSLHandler := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
HTTPClient := TIdHTTP.Create(nil);
Parameters := TStringList.Create;
try
SSLHandler.SSLOptions.Method := sslvSSLv3;
SSLHandler.SSLOptions.Mode := sslmUnassigned;
HTTPClient.IOHandler := SSLHandler;
HTTPClient.HTTPOptions := [hoForceEncodeParams];
HTTPClient.Request.ContentType := 'application/x-www-form-urlencoded';
Parameters.Add('Action=VerifyEmailAddress');
Parameters.Add('EmailAddress=test@test.com');
Parameters.Add('AWSAccessKeyId=012Some123Key46');
Parameters.Add('SignatureVersion=2');
Parameters.Add('Expires='); // ???
Parameters.Add('Signature='); // ???
PageMemo.Text := HTTPClient.Post('https://email.us-east-1.amazonaws.com', Parameters);
finally
SSLHandler.Free;
HTTPClient.Free;
Parameters.Free;
end;
end;
Solution 2:
Basically, you need to use the right library, i.e.:
For Indy 10.5.7 use openssl-1.0.1e-i386-win32 or openssl-1.0.1e-x64_86-win64 from http://indy.fulgan.com/SSL/
You may want to download an ssl demo from: http://indy.fulgan.com/ZIP/
Regards
Jose
How can we connect with a website? Getting SSL error 1409442E, 2 (the latest version that Indy currently supports is 1.0.2u), and then you need to enable the sslvTLSv1_2 flag in the SSLIOHandler’s SSLOptions
How to get images from HTTPS URL in Delphi?
Question:
I’m trying to load a
TImage
starting from an URL as explained in this answer.
uses
GIFImg;
procedure TForm1.Button1Click(Sender: TObject);
var
Stream : TMemoryStream;
GIF : TGIFImage;
begin
Stream := TMemoryStream.Create;
GIF := TGIFImage.Create;
try
IdHTTP1.Get('http://www.google.com/intl/en_ALL/images/logo.gif', Stream);
//IdHTTP1.Get('https://www.google.com/intl/en_ALL/images/logo.gif', Stream);
Stream.Position := 0;
GIF.LoadFromStream(Stream);
Image1.Picture.Assign(GIF);
finally
FreeAndNil(GIF);
FreeAndNil(Stream);
end;
end;
All works good if the URL starts with a simple HTTP.
When I try to load from an HTTPS URL, I get an
EIdIOHandlerPropInvalid
exception with message:
IOHandler value is not valid.
I’ve tried adding a
TIdSSLIOHandlerSocketOpenSSL
and setting it as
IOHandler
for the
TIdHTTP
component.
After doing that, I get an
EIdOSSLCouldNotLoadSSLLibrary
exception with the following message:
Could not load SSL library
.
Is there something wrong in the properties or some other problem?
Solution 1:
You need the SSL library (two .DLL files) either installed in your Windows, or distributed along with your application.
Seems to be downloadable here:
https://slproweb.com/products/Win32OpenSSL.html
Or via their official web site (but I can’t find downloadable binaries there — only source code):
https://www.openssl.org/source/
Pre-compiled .DLLs for use with Indy can be downloaded here:
https://indy.fulgan.com/SSL/ (Thanks, Zed)
Solution 2:
When I try to load from an HTTPS URL, I get an
EIdIOHandlerPropInvalid
exception with message:IOHandler value is not valid.
That error means you don’t have an
TIdSSLIOHandlerSocketBase
-derived component attached to the
TIdHTTP.IOHandler
property, such as
TIdSSLIOHandlerSocketOpenSSL
.
This error also tells me that you are using an outdated version of Indy and need to upgrade.
TIdHTTP
automatically creates a default
SSLIOHandler
when requesting an HTTPS url and no
IOHandler
is currently assigned, and has done so for a long time.
I’ve tried adding a
TIdSSLIOHandlerSocketOpenSSL
and setting it as
IOHandler
for the
TIdHTTP
component.
That is the correct solution, if you do not want to upgrade, or if you need to customize the
SSLIOHandler
settings, such as for enabling TLS 1.1+ (which
TIdSSLIOHandlerSocketOpenSSL
does not do by default yet).
After doing that, I get an
EIdOSSLCouldNotLoadSSLLibrary
exception with the following message:Could not load SSL library.
That error means that either
-
you have not deployed the
OpenSSL DLLs
(
libeay32.dll
and
ssleay32.dll
) with your app, or at least have them installed somewhere on your system’s DLL search path. -
you are using a version of the DLLs that is incompatible with your version of Indy. The current version of Indy supports
openssl 1.0.2
and earlier (support for OpenSSL 1.1.x is currently a work in progress).
After the error is raised, you can use Indy’s
WhichFailedToLoad()
function in the
IdSSLOpenSSLHeaders
unit to determine the root cause of the failure — whether the DLLs themselves could not be loaded in memory (because they were not found, etc), or because they are missing specific exports that Indy requires.
Delphi — THTTPRIO — IOHandler value is not valid, «IOHandler value is not valid» is indeed an Indy error message. It is raised by Indy’s TIdHTTP component when its IOHandler property is not
Topic: [SOLVED] imdb iohandler error on movies without poster (Read 19501 times)
0 Members and 1 Guest are viewing this topic.
« Last Edit: October 26, 2010, 12:46:24 am by rick.ca »
Logged
Ok, after more tests, found out what is causing the problem.
In my IMDB script, I enabled «Download Image». When there are no image in that movie in imdb, this error will appear and stop the script.
This is some bug on the script? Cause it was working fine before I upgraded to latest script.
Logged
Logged
Is this just happening to me or to others too?
It seems abubin has already diagnosed the problem correctly.
Logged
Hello
I always use the images from IMDB. And I still get the problem as described above. Indeed when i turn of the download image option in the imdb plugin, the problem is solved. But with the new patch the problem still occurs. Do I have to turn the option on and off every time? or is there a better sollution?
Greets,
Ungrimmer.
Logged
All the examples posted here now work for me. Is there a different circumstance where the error occurs, or is it still happening with any title that doesn’t have a poster?
Logged
It should really work now as I could find the problem and fix it.
Logged
Gentlemen, you can’t fight in here! This is the War Room!
Works fine now! thanx
another fast and good update… wow
Logged
Hello,
The problem is re-occuring. With the following movies:
Sin Yan 2010
The mighty macs 2009
Chun Sing Gai Bei 2010
Greetz,
Ungrimmer
Logged
These work for me as well (now using version 0.9.6.0). It seems unlikely this has anything to do with the plugin. Please post a log.
Logged
maybe because its because the update doesn’t work?? I will post a log when the next problem occurs.
Greetz
Logged