I try to open a site, i don't know if it is in INTERNET or INTRANET because i'm in my enterprise behind a PROXY
If i use this code "ReceiveHTTPMemory" return 0 in the BufferHtml
Code: Select all
InitNetwork()
HTTPProxy("http://XXX.XXX.XXX.XX:8080")
*BufferHtml = ReceiveHTTPMemory("https://tyu.myenterprise.fr/tyuPortail/sso/my.policy")
Debug *BufferHtml
If *BufferHtml
Taille = MemorySize(*BufferHtml)
Html$ = PeekS(*BufferHtml, Taille, #PB_UTF8|#PB_ByteLength)
FreeMemory(*BufferHtml)
Debug html$
EndIf
Code: Select all
Procedure HTTP_ChargePageInternetEnMemoire(Url.s, *EndSize.LONG, ProxyNomEtPort.s = "", Login.s = "", Mdp.s = "")
Protected agent.s, hINet.l, hData.l, bytes.l
agent.s = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Trident/5.0)"
If Trim(ProxyNomEtPort) <> ""
open_handle = InternetOpen_(@agent, #INTERNET_OPEN_TYPE_PRECONFIG, ProxyNomEtPort , "", 0) ; Si proxy
hINet = InternetConnect_(open_handle, url, #INTERNET_DEFAULT_HTTP_PORT, Login, Mdp , #INTERNET_SERVICE_HTTP, #Null, #Null)
hData.l = InternetOpenUrl_(open_handle, @url, "", 0, 0, 0)
Else
hINet.l = InternetOpen_(@agent, 0, 0, 0, 0)
hData.l = InternetOpenUrl_(hINet, @url.s, "", 0, 80|$4000000, 0)
EndIf
If hINet And hData
*MemoryID = AllocateMemory(5000000)
EndIf
If hData > 0
InternetReadFile_(hData, *MemoryID, 5000000, @bytes.l)
Else
bytes = -1
EndIf
*EndSize\l = bytes
InternetCloseHandle_(hINet)
InternetCloseHandle_(hFile)
InternetCloseHandle_(hData)
EndProcedure
*EndSize.long = AllocateMemory(10000)
*Buffer = HTTP_ChargePageInternetEnMemoire("https://tyu.myenterprise.fr/tyuPortail/sso/my.policy", *EndSize.LONG, "http://XXX.XXX.XXX.XX:8080", "", "")
Debug *EndSize
Debug PeekS(*Buffer, *EndSize, #PB_UTF8) ; ==> PB v5.24
Debug PeekS(*Buffer, *EndSize, #PB_Ascii) ; ==> PB v5.60
FreeMemory(*Buffer)
I have try several time, and it's the same thing
I can continue to works, because i use now "HTTP_ChargePageInternetEnMemoire" but it's when even important to understand what is the problem
Apparently FRED not use this function behind ReceiveHTTPMemory
Then i have three questions, who germ into my flower pot brain
Someone know
1/ What style of site it is, for not can read by ReceiveHTTPMemory ?
2/ Is it normal ? or ReceiveHTTPMemory normally must read all the site Http or Https
3/ Have you a way for know if the site i visit is in INTRANET or INTERNET when i'm behind my proxy in my job
Have a good day