Page 1 of 2

Execute php or vbs code

PostPosted: Thu Aug 31, 2023 6:19 pm
by wartiaga
Hi,

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

Thanks!

Re: Execute php or vbs code

PostPosted: Thu Aug 31, 2023 9:20 pm
by leandro
Creo que lo puedes hacer usando webview, pero debes contar con un servidor web así sea de manera local.

Re: Execute php or vbs code

PostPosted: Fri Sep 01, 2023 7:00 am
by Antonio Linares
Code: Select all  Expand view
#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
 

Re: Execute php or vbs code

PostPosted: Fri Sep 01, 2023 5:08 pm
by wartiaga
Antonio Linares wrote:
Code: Select all  Expand view
#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?

Re: Execute php or vbs code

PostPosted: Fri Sep 01, 2023 7:14 pm
by Antonio Linares
Enrico may help us on this

Enrico do you know where to get it ? many thanks

Re: Execute php or vbs code

PostPosted: Fri Sep 01, 2023 8:58 pm
by Enrico Maria Giordano
You have to build it yourself. From winmake\readme.txt:

Code: Select all  Expand view
SET HB_DIR_CURL=<install dir>
Required to build hbcurl.lib
Download URL: http://curl.haxx.se/

Re: Execute php or vbs code

PostPosted: Sat Sep 02, 2023 9:55 am
by Enrico Maria Giordano
Antonio, did you receive hbcurl.lib for xHarbour? I've sent it to you yesterday on 23:28.

Re: Execute php or vbs code

PostPosted: Sat Sep 02, 2023 1:51 pm
by wartiaga
Enrico Maria Giordano wrote:You have to build it yourself. From winmake\readme.txt:

Code: Select all  Expand view
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.

Re: Execute php or vbs code

PostPosted: Sat Sep 02, 2023 2:46 pm
by Enrico Maria Giordano

Re: Execute php or vbs code

PostPosted: Sat Sep 02, 2023 2:56 pm
by wartiaga
Enrico Maria Giordano wrote:Here it is:

https://wormhole.app/6lE98#DrUiOoCwc3x7kgJ2O-EDDA


Thank You Enrico!

Re: Execute php or vbs code

PostPosted: Sat Sep 02, 2023 3:10 pm
by wartiaga
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

Re: Execute php or vbs code

PostPosted: Sat Sep 02, 2023 3:19 pm
by Enrico Maria Giordano
FWH 11.05? Very very old (May 2011). Could it be the reason for the errors? Antonio?

Re: Execute php or vbs code

PostPosted: Sat Sep 02, 2023 3:23 pm
by wartiaga
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.

Re: Execute php or vbs code

PostPosted: Sat Sep 02, 2023 3:29 pm
by Enrico Maria Giordano
Right. Try libcurl.lib from FWH lib directory.

Re: Execute php or vbs code

PostPosted: Sat Sep 02, 2023 3:44 pm
by wartiaga
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!