Page 1 of 1

perform PHP functions

Posted: Fri Mar 13, 2020 11:21 am
by Natter
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 ?

Re: perform PHP functions

Posted: Fri Mar 13, 2020 7:52 pm
by Antonio Linares
live demo:
https://www.modharbour.org/modharbour_s ... allphp.prg

Code: Select all

#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

Re: perform PHP functions

Posted: Fri Mar 13, 2020 8:15 pm
by Natter
Thank you very much !

Re: perform PHP functions

Posted: Sat Mar 14, 2020 12:45 pm
by Otto
Dear Antonio,
This seems very interesting.
Can you please explain what practical utility we have. How does this work?
Best regards,
Otto

Re: perform PHP functions

Posted: Sat Mar 14, 2020 3:44 pm
by Antonio Linares
Dear Otto,

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