SA-MP Forums Archive
Call PHP Functions with a HTTP request? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Call PHP Functions with a HTTP request? (/showthread.php?tid=284030)



Call PHP Functions with a HTTP request? - Gomma - 17.09.2011

Hey,
I am not really experienced with the function "HTTP" but I did get it working some time ago, using a PHP file.

Now, I wanna try it again, but in this case I want to call a specific function inside a PHP file. Is that possible?

PHP Code:
<?php
    
function f1() {
        ....
Something here
    
}
    
    function 
f2() {
        ... and 
something here
    
}
?>
Would it be possible to call a single function with sending a threaded HTTP Request?

Thanks.


Re: Call PHP Functions with a HTTP request? - Limex - 17.09.2011

PHP Code:
<?php
    
function f1() {
        ....
Something here
    
}
    
    function 
f2() {
        ... and 
something here
    
}
if( 
$_GET['func'] == )
{
function 
f1();
}
else if( 
$_GET['func'] == )
{
function 
f2();
}
?>
So for example, if php file was called samp.php

If you called samp.php?func=1 the first function would be called etc.

Quote:

This forum requires that you wait 120 seconds between posts.




AW: Re: Call PHP Functions with a HTTP request? - Gomma - 17.09.2011

Quote:
Originally Posted by Limex
View Post
PHP Code:
<?php
    
function f1() {
        ....
Something here
    
}
    
    function 
f2() {
        ... and 
something here
    
}
if( 
$_GET['func'] == )
{
function 
f1();
}
else if( 
$_GET['func'] == )
{
function 
f2();
}
?>
So for example, if php file was called samp.php

If you called samp.php?func=1 the first function would be called etc.
Ah thanks a lot! That's exactly what I've meant.