Hi guys!
I am creating a program to grab some information from remote sites to generate EPG data for my satellite receiver (I know that epg functions are build in)
Now when I try this URL (
https://www.viasat.dk/tv-guide#!/channel?selected=YYYYMMDD) I get at Bad request 400, however, works perfectly in my web browser and the code I am using is this:
procedure TForm1.GetWEBContent;
begin
try
try
HTTPinfo := TIdHTTP.Create(nil);
IOcontroller := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
IOcontroller.SSLOptions.SSLVersions := [sslvTLSv1,sslvTLSv1_1,sslvTLSv1_2,sslvSSLv2,sslvSSLv23,sslvSSLv3];
HTTPinfo.Request.UserAgent := 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.18362';
HTTPinfo.Request.Method := 'GET';
HTTPinfo.Request.Accept := '*/*';
HTTPinfo.Request.ContentType := '*/*';
HTTPinfo.Request.AcceptCharset := 'UTF-8';
HTTPinfo.Request.AcceptEncoding := 'UTF-8';
HTTPinfo.Request.Charset := 'UTF-8';
HTTPinfo.ProtocolVersion := pv1_1;
HTTPinfo.HTTPOptions := [hoForceEncodeParams,hoWaitForUnexpectedData,hoWantProtocolErrorContent];
HTTPinfo.IOHandler := IOcontroller;
http_result := HTTPinfo.Get(http_url, IndyTextEncoding_UTF8);
except
on E: EIdHTTPProtocolException do
begin
http_result := 'HTTP: '+#13#10+'Errorcode: '+IntToStr(E.ErrorCode)+#13#10+'Errormessage: '+E.ErrorMessage;
end;
on E: Exception do
begin
http_result := 'General:'+#13#10+'Errormessage: '+E.Message;
end;
end;
finally
HTTPinfo.Free;
IOcontroller.Free;
end;
end;
I have tried with Synapse EncodeURL and without same result,
Any one any ideas ?
