Geolocation by IP address in Alaska
- Eugene Lutsenko
- Posts: 1649
- Joined: Sat Feb 04, 2012 2:23 am
- Location: Russia, Southern federal district, city of Krasnodar
- Contact:
Geolocation by IP address in Alaska
There is a geolocation service: https://ip-api.com/#71.39.117.6 . How to pull information in curly brackets into a text variable?
			
			
									
									
						Re: Geolocation by IP address in Alaska
hi Eugene,
i have try ">> Logme.TXT" and " | CLIP " but both does not work when call from App ... 
 
so i create a *.BAT and call that *.BAT
it is HMG Syntax but should be easy to translate to Xbase++
			
			
									
									i have try ">> Logme.TXT" and " | CLIP " but both does not work when call from App ...
 
 so i create a *.BAT and call that *.BAT
Code: Select all
   nHandle := FCREATE( cFile, FC_NORMAL )
   IF nHandle == - 1
      MsgInfo( "Error create File : " + cFile, STR( FERROR() ) )
      RETURN
   ELSE
      FWRITE( nHandle, cRun + cPara + cClip)
      FCLOSE( nHandle )
   ENDIF
   System.EmptyClipboard
   ShellExecute( 0, "open", cFile,,, SW_HIDE )
   DO WHILE EMPTY(System.Clipboard )
      hb_idleSleep( 0.1 )
   ENDDO
   cMemo := System.Clipboardgreetings by OHR
Jimmy
						Jimmy
- Eugene Lutsenko
- Posts: 1649
- Joined: Sat Feb 04, 2012 2:23 am
- Location: Russia, Southern federal district, city of Krasnodar
- Contact:
Re: Geolocation by IP address in Alaska
Hi, Jimmy! I have a problem reading the site into a text variable without opening the browser. The rest is not a problem for me
			
			
									
									
						Auge_Ohr wrote: ↑Mon Jun 20, 2022 11:47 pm hi Eugene,
i have try ">> Logme.TXT" and " | CLIP " but both does not work when call from App ...
so i create a *.BAT and call that *.BATit is HMG Syntax but should be easy to translate to Xbase++Code: Select all
nHandle := FCREATE( cFile, FC_NORMAL ) IF nHandle == - 1 MsgInfo( "Error create File : " + cFile, STR( FERROR() ) ) RETURN ELSE FWRITE( nHandle, cRun + cPara + cClip) FCLOSE( nHandle ) ENDIF System.EmptyClipboard ShellExecute( 0, "open", cFile,,, SW_HIDE ) DO WHILE EMPTY(System.Clipboard ) hb_idleSleep( 0.1 ) ENDDO cMemo := System.Clipboard
Re: Geolocation by IP address in Alaska
this is exact what i doEugene Lutsenko wrote: ↑Tue Jun 21, 2022 1:07 am Hi, Jimmy! I have a problem reading the site into a text variable without opening the browser. The rest is not a problem for me
 
 
Code: Select all
PROCEDURE MAIN(cNewIP)
LOCAL cRun := "curl "
LOCAL cPara := "ip-api.com "
LOCAL cClip := " | CLIP "
LOCAL cFile := "GetIP.BAT"
LOCAL cMemo , nHandle
greetings by OHR
Jimmy
						Jimmy
- Eugene Lutsenko
- Posts: 1649
- Joined: Sat Feb 04, 2012 2:23 am
- Location: Russia, Southern federal district, city of Krasnodar
- Contact:
Re: Geolocation by IP address in Alaska
"ip-api.com " - this is not a local program, but a website
			
			
									
									
						Re: Geolocation by IP address in Alaska
You can do this with LoadFromURL().I have a problem reading the site into a text variable without opening the browser.
 The eXpress train is coming - and it has more cars.
						- Eugene Lutsenko
- Posts: 1649
- Joined: Sat Feb 04, 2012 2:23 am
- Location: Russia, Southern federal district, city of Krasnodar
- Contact:
Re: Geolocation by IP address in Alaska
When I launch in the browser address bar http://ip-api.com/#71.39.117.6 I get: It suits me fine. But I would like to get the html code drawing this page in the browser. When I try to do this, it turns out that.
Code: Select all
cResponse := LoadFromURL( 'http://ip-api.com/#71.39.117.6' )
MsgBox(cResponse)- Attachments
- 
			
		
				- Безымянный2.jpg (965.43 KiB) Viewed 10084 times
 
- 
			
		
				- Безымянный.jpg (234.49 KiB) Viewed 10084 times
 
- Eugene Lutsenko
- Posts: 1649
- Joined: Sat Feb 04, 2012 2:23 am
- Location: Russia, Southern federal district, city of Krasnodar
- Contact:
Re: Geolocation by IP address in Alaska
Code: Select all
     cResponse := LoadFromURL( 'http://ip-api.com/#71.39.117.6' )
     MsgBox(cResponse)
     cResponse := LoadFromURL( 'http://ip-api.com/json/71.39.117.6' )
     MsgBox('json'+', '+cResponse)
     cResponse := LoadFromURL( 'http://ip-api.com/xml/71.39.117.6' )
     MsgBox('xml'+', '+cResponse)
     cResponse := LoadFromURL( 'http://ip-api.com/csv/71.39.117.6' )
     MsgBox('csv'+', '+cResponse)
     cResponse := LoadFromURL( 'http://ip-api.com/line/71.39.117.6' )
     MsgBox('line'+', '+cResponse)
     cResponse := LoadFromURL( 'http://ip-api.com/php/71.39.117.6' )
     MsgBox('php'+', '+cResponse)- Attachments
- 
			
		
				- Безымянный3.jpg (56.45 KiB) Viewed 10075 times
 
- 
			
		
				- Безымянный2.jpg (61.16 KiB) Viewed 10075 times
 
- 
			
		
				- Безымянный1.jpg (38.54 KiB) Viewed 10075 times
 
- Eugene Lutsenko
- Posts: 1649
- Joined: Sat Feb 04, 2012 2:23 am
- Location: Russia, Southern federal district, city of Krasnodar
- Contact:
Re: Geolocation by IP address in Alaska
I did everything. It turned out well. FUNCTION RecreateDB() here: http://lc.kubagro.ru/__AidosALL.txt
Thank you all very much!
			
			
									
									
						Thank you all very much!


