FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Execute php or vbs code
Posts: 253
Joined: Wed May 25, 2016 01:04 AM
Execute php or vbs code
Posted: Thu Aug 31, 2023 06:19 PM

Hi,

How can I run an external code in php or vbs from fivewin?

Thanks!

Posts: 1816
Joined: Wed Oct 26, 2005 02:49 PM
Re: Execute php or vbs code
Posted: Thu Aug 31, 2023 09:20 PM

Creo que lo puedes hacer usando webview, pero debes contar con un servidor web así sea de manera local.

Saludos
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Turbo Incremental Link64 6.98 Embarcadero 7.70 ] [ FiveWin 25.01 ] [ xHarbour 64 bits) ]
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Execute php or vbs code
Posted: Fri Sep 01, 2023 07:00 AM
Code (fw): Select all Collapse
#include "c:\harbour\contrib\hbcurl\hbcurl.ch"

function Main()

  curl_global_init()

  ? "Hello world"

  ? callPHP( "www.fivetechsoft.com/getip.php" ) 

   curl_global_cleanup()

return nil

function callPHP( cUrl )

   local hCurl, uValue

   if ! empty( hCurl := curl_easy_init() )
        curl_easy_setopt( hCurl, HB_CURLOPT_URL, cUrl )
        curl_easy_setopt( hCurl, HB_CURLOPT_DL_BUFF_SETUP )

        if curl_easy_perform( hCurl ) == 0
           uValue = curl_easy_dl_buff_get( hCurl )
        endif
   endif

return uValue
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 253
Joined: Wed May 25, 2016 01:04 AM
Re: Execute php or vbs code
Posted: Fri Sep 01, 2023 05:08 PM
Antonio Linares wrote:
Code (fw): Select all Collapse
#include "c:\harbour\contrib\hbcurl\hbcurl.ch"

function Main()

  curl_global_init()

  ? "Hello world"

  ? callPHP( "www.fivetechsoft.com/getip.php" ) 

   curl_global_cleanup()

return nil

function callPHP( cUrl )

   local hCurl, uValue

   if ! empty( hCurl := curl_easy_init() )
        curl_easy_setopt( hCurl, HB_CURLOPT_URL, cUrl )
        curl_easy_setopt( hCurl, HB_CURLOPT_DL_BUFF_SETUP )

        if curl_easy_perform( hCurl ) == 0
           uValue = curl_easy_dl_buff_get( hCurl )
        endif
   endif

return uValue
Thanks Antonio, I use xharbour, where I can find curl compiled for xharbour?
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Execute php or vbs code
Posted: Fri Sep 01, 2023 07:14 PM

Enrico may help us on this

Enrico do you know where to get it ? many thanks

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Execute php or vbs code
Posted: Fri Sep 01, 2023 08:58 PM
You have to build it yourself. From winmake\readme.txt:
Code (fw): Select all Collapse
SET HB_DIR_CURL=<install dir>
Required to build hbcurl.lib
Download URL: http://curl.haxx.se/
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Execute php or vbs code
Posted: Sat Sep 02, 2023 09:55 AM

Antonio, did you receive hbcurl.lib for xHarbour? I've sent it to you yesterday on 23:28.

Posts: 253
Joined: Wed May 25, 2016 01:04 AM
Re: Execute php or vbs code
Posted: Sat Sep 02, 2023 01:51 PM
Enrico Maria Giordano wrote:You have to build it yourself. From winmake\readme.txt:
Code (fw): Select all Collapse
SET HB_DIR_CURL=<install dir>
Required to build hbcurl.lib
Download URL: http://curl.haxx.se/
Enrico,
I tried to compile xharbour and curl and got several errors, can you send me the lib already compiled? Thanks.
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Posts: 253
Joined: Wed May 25, 2016 01:04 AM
Re: Execute php or vbs code
Posted: Sat Sep 02, 2023 02:56 PM
Enrico Maria Giordano wrote:Here it is:

https://wormhole.app/6lE98#DrUiOoCwc3x7kgJ2O-EDDA
Thank You Enrico!
Posts: 253
Joined: Wed May 25, 2016 01:04 AM
Re: Execute php or vbs code
Posted: Sat Sep 02, 2023 03:10 PM
Enrico Maria Giordano wrote:Here it is:

https://wormhole.app/6lE98#DrUiOoCwc3x7kgJ2O-EDDA
Enrico, using Antonio's example, I have several errors. Need some other lib?

Error: Unresolved external 'WSAIoctl' referenced from D:\LANG\FWH1105\XH1.2.1\LIB\HBCURL.LIB|hbcurl
Error: Unresolved external '_curl_global_init_mem' referenced from D:\LANG\FWH1105\XH1.2.1\LIB\HBCURL.LIB|hbcurl
Error: Unresolved external '_curl_global_cleanup' referenced from D:\LANG\FWH1105\XH1.2.1\LIB\HBCURL.LIB|hbcurl
Error: Unresolved external '_curl_formfree' referenced from D:\LANG\FWH1105\XH1.2.1\LIB\HBCURL.LIB|hbcurl
Error: Unresolved external '_curl_easy_cleanup' referenced from D:\LANG\FWH1105\XH1.2.1\LIB\HBCURL.LIB|hbcurl
Error: Unresolved external '_curl_easy_reset' referenced from D:\LANG\FWH1105\XH1.2.1\LIB\HBCURL.LIB|hbcurl
Error: Unresolved external '_curl_easy_duphandle' referenced from D:\LANG\FWH1105\XH1.2.1\LIB\HBCURL.LIB|hbcurl
Error: Unresolved external '_curl_easy_init' referenced from D:\LANG\FWH1105\XH1.2.1\LIB\HBCURL.LIB|hbcurl
Error: Unresolved external '_curl_easy_pause' referenced from D:\LANG\FWH1105\XH1.2.1\LIB\HBCURL.LIB|hbcurl
Error: Unresolved external '_curl_easy_perform' referenced from D:\LANG\FWH1105\XH1.2.1\LIB\HBCURL.LIB|hbcurl
Error: Unresolved external '_curl_easy_send' referenced from D:\LANG\FWH1105\XH1.2.1\LIB\HBCURL.LIB|hbcurl
Error: Unresolved external '_curl_easy_recv' referenced from D:\LANG\FWH1105\XH1.2.1\LIB\HBCURL.LIB|hbcurl
Error: Unresolved external '_curl_formadd' referenced from D:\LANG\FWH1105\XH1.2.1\LIB\HBCURL.LIB|hbcurl
Error: Unresolved external '_curl_slist_append' referenced from D:\LANG\FWH1105\XH1.2.1\LIB\HBCURL.LIB|hbcurl
Error: Unresolved external '_curl_easy_setopt' referenced from D:\LANG\FWH1105\XH1.2.1\LIB\HBCURL.LIB|hbcurl
Error: Unresolved external '_curl_easy_getinfo' referenced from D:\LANG\FWH1105\XH1.2.1\LIB\HBCURL.LIB|hbcurl
Error: Unresolved external '_curl_slist_free_all' referenced from D:\LANG\FWH1105\XH1.2.1\LIB\HBCURL.LIB|hbcurl
Error: Unresolved external '_curl_easy_escape' referenced from D:\LANG\FWH1105\XH1.2.1\LIB\HBCURL.LIB|hbcurl
Error: Unresolved external '_curl_easy_unescape' referenced from D:\LANG\FWH1105\XH1.2.1\LIB\HBCURL.LIB|hbcurl
Error: Unresolved external '_curl_version' referenced from D:\LANG\FWH1105\XH1.2.1\LIB\HBCURL.LIB|hbcurl
Error: Unresolved external '_curl_version_info' referenced from D:\LANG\FWH1105\XH1.2.1\LIB\HBCURL.LIB|hbcurl
Error: Unresolved external '_curl_easy_strerror' referenced from D:\LANG\FWH1105\XH1.2.1\LIB\HBCURL.LIB|hbcurl
Error: Unresolved external '_curl_getdate' referenced from D:\LANG\FWH1105\XH1.2.1\LIB\HBCURL.LIB|hbcurl
Error: Unresolved external '_curl_escape' referenced from D:\LANG\FWH1105\XH1.2.1\LIB\HBCURL.LIB|hbcurl
Error: Unresolved external '_curl_unescape' referenced from D:\LANG\FWH1105\XH1.2.1\LIB\HBCURL.LIB|hbcurl
Error: Unresolved external '_curl_free' referenced from D:\LANG\FWH1105\XH1.2.1\LIB\HBCURL.LIB|hbcurl
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Execute php or vbs code
Posted: Sat Sep 02, 2023 03:19 PM

FWH 11.05? Very very old (May 2011). Could it be the reason for the errors? Antonio?

Posts: 253
Joined: Wed May 25, 2016 01:04 AM
Re: Execute php or vbs code
Posted: Sat Sep 02, 2023 03:23 PM
Enrico Maria Giordano wrote:FWH 11.05? Very very old (May 2011). Could it be the reason for the errors? Antonio?
Error: Unresolved external 'WSAIoctl' referenced from D:\LANG\FWH1105\XH1.2.1\LIB\HBCURL.LIB|hbcurl

In this case I found the solution linking ws2_32.lib

But others I think need to link others lib.
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Execute php or vbs code
Posted: Sat Sep 02, 2023 03:29 PM

Right. Try libcurl.lib from FWH lib directory.

Posts: 253
Joined: Wed May 25, 2016 01:04 AM
Re: Execute php or vbs code
Posted: Sat Sep 02, 2023 03:44 PM
Enrico Maria Giordano wrote:Right. Try libcurl.lib from FWH lib directory.
Good, no error, but in execution gives: Unrecoverable error 9011 - hb_xfree called with null pointer
Thank you!