FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour perform PHP functions
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
perform PHP functions
Posted: Fri Mar 13, 2020 11:21 AM

Hi,

I open IE as Activex and load the site. If the HTML of this site contains JS scripts, I can execute them from my program using the method: execScript (name, type). How can I perform PHP functions ?

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: perform PHP functions
Posted: Fri Mar 13, 2020 07:52 PM
live demo:
https://www.modharbour.org/modharbour_samples/callphp.prg

Code (fw): Select all Collapse
#include "c:\harbour\contrib\hbcurl\hbcurl.ch"

function Main()

  ? "Hello world"

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

return nil

function callPHP( cUrl )

   local uValue

   curl_global_init()

   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

   curl_global_cleanup()

return uValue
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: perform PHP functions
Posted: Fri Mar 13, 2020 08:15 PM

Thank you very much !

Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: perform PHP functions
Posted: Sat Mar 14, 2020 12:45 PM

Dear Antonio,
This seems very interesting.
Can you please explain what practical utility we have. How does this work?
Best regards,
Otto

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: perform PHP functions
Posted: Sat Mar 14, 2020 03:44 PM

Dear Otto,

Basically we can connect to any website that returns a value and use it :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion