Execute HTTP(S)-request

tmajvdlaantmajvdlaan Member Posts: 7
Hi,

I want to execute a URL from within NAV; via HYPERLINK this works fine, but I don't want to open an IE-window, when, e.g., a validate of a field must execute a URL.

How can I do this? Someone points me to utility wget, but as far as I can see, this tool can only download files, and not execute some URL's.

Thanks in advance!

Martijn

Comments

  • nunomaianunomaia Member Posts: 1,153
    You can use Microsoft HTML Object Library automation to achive that.
    Nuno Maia

    Freelance Dynamics AX
    Blog : http://axnmaia.wordpress.com/
  • MalajloMalajlo Member Posts: 294
    This could help you...
    Var	Name	DataType	Subtype	Length
    Ne	URL	Text		1024
    Ne	Path	Text		1024
    Ne	FileName	Text		1024
    
    Name	DataType	Subtype	Length
    objSHX	Automation	'Microsoft WinHTTP Services, version 5.1'.WinHttpRequest	
    objADOStream	Automation	'Microsoft ActiveX Data Objects 2.8 Library'.Stream	
    FileN	Text		250
    ParsedText	Text		1024
    Cookie	File		
    CookieData	BigText		
    ParsedData	Text		1024
    InStr	InStream		
    
    
    HTTPGet2(URL : Text[1024];Path : Text[1024];FileName : Text[1024]) : Text[1024]
    CREATE(objSHX) ;
    CREATE(objADOStream) ;
    ParsedText := URL ;
    
    FileN := Path+'\'+FileName ;
    objSHX.Open('GET',URL,FALSE) ;
    objSHX.SetRequestHeader('Cookie','g=password; u=user') ;
    objSHX.Send ;
    IF objSHX.Status = 200 THEN
      BEGIN
        objADOStream.Type := 1 ;
        objADOStream.Open ;
        objADOStream.Read ;
        objADOStream.Write(objSHX.ResponseBody) ;
        objADOStream.SaveToFile(FileN,2) ;
        objADOStream.Close ;
    
        //Check if file is zipped...
        IF COPYSTR(ParsedText,STRLEN(ParsedText)-2,3) = 'zip' THEN UnZIP(FileN,FileName) ;
    ....
    
Sign In or Register to comment.