This topic is locked
[SOLVED]

 Receive parameter in URL and pass to PHPRunner application

2/8/2019 11:07:47 AM
PHPRunner General questions
T
Tayyab Ilyas author

I want to receive some parameters in URL before the website (which developed in PHPRunner) initiates and then save the parameter values in the database
Example URL:
https://phprunnerdevelopedapp.com/?ip=192.168.0.1&port=6666&user=bob&dateofbirth=120882&group=hotel_yx&user_url=http://www.example.com
Any guidance on how to begin with, I don't see any event like before application initializes etc.

J
John 2/8/2019

You can use $_GET["variable name"]

See https://www.w3school...p/php_forms.asp for guidance and usage..

John

T
Tayyab Ilyas author 2/8/2019

Hi, Yes I have an idea how you do it outside of PHPRunner but I am not sure how do I use this within PHPRunner. Is there any event which triggers at first when PHPRunner developed app laods. I see after app initialization event but is there any event like before app initialization?

You can use $_GET["variable name"]

See https://www.w3school...p/php_forms.asp for guidance and usage..

John

admin 2/8/2019

Use AfterAppInit event for this purpose.

T
Tayyab Ilyas author 2/10/2019



Use AfterAppInit event for this purpose.


I have the following code in AfteInit event


$_Session['ap_ip']=$_GET['ap_ip'];

$_Session['ap_port']=$_GET['ap_port'];

$_Session['ap_id']=$_GET['ap_id'];

$_Session['ap_group']=$_GET['ap_group'];

$_Session['user_mac']=$_GET['user_mac'];

$_Session['user_url']=$_GET['user_url'];
echo "Session AP IP: ".$_Session['ap_ip']."
";

echo "Session AP Port: ".$_Session['ap_port']."
";

echo "Session AP MAC: ".$_Session['ap_id']."
";

echo "Session AP Group: ".$_Session['ap_group']."
";

echo "Session User MAC: ".$_Session['user_mac']."
";

echo "Session User URL: ".$_Session['user_url']."
";


& I am trying to pass following variables but session variables remain unpopulated


http://localhost:81/project/?ap_ip=10.0.0.1&ap_port=8080&ap_id=B04E263B73C8&ap_group=test_ssid&vendor=tanaza&version=3&user_url=http%3a%2f%2fconnectivitycheck.gstatic.com%2fgenerate_204&user_mac=60:f1:89:26:fb:c0&tsl=1549653709


S
smez 2/11/2019
T
Tayyab Ilyas author 2/15/2019

Hi Smez,
Thanks for help, it worked but now the issue is following
I read parameters in after app init
When I pass the parameter on the main domain eg below it does not save values in session variables
example.com/?ap_id="1234";
but when i pass varaiable on any tables add page it works
example.com/landing_add.php?ap_id="1234";



Use $_SESSION instead of $_Session
See:

https://stackoverflo...ions-being-lost