perform PHP functions

perform PHP functions

Postby Natter » 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 ?
Natter
 
Posts: 1215
Joined: Mon May 14, 2007 9:49 am

Re: perform PHP functions

Postby Antonio Linares » Fri Mar 13, 2020 7:52 pm

live demo:
https://www.modharbour.org/modharbour_samples/callphp.prg

Code: Select all  Expand view
#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
User avatar
Antonio Linares
Site Admin
 
Posts: 42082
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: perform PHP functions

Postby Natter » Fri Mar 13, 2020 8:15 pm

Thank you very much !
Natter
 
Posts: 1215
Joined: Mon May 14, 2007 9:49 am

Re: perform PHP functions

Postby Otto » 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
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6330
Joined: Fri Oct 07, 2005 7:07 pm

Re: perform PHP functions

Postby Antonio Linares » Sat Mar 14, 2020 3: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42082
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 86 guests