Go4Expert

Go4Expert (http://www.go4expert.com/)
-   PHP (http://www.go4expert.com/forums/php/)
-   -   php script from a browser (http://www.go4expert.com/forums/php-script-browser-t24925/)

mike_ledis 10Feb2011 05:28

php script from a browser
 
Hello! Suppose that a php script exists in a server and i have access as a client.that script has 4 args first and second are char args third and forth are int args. If i want to run that script from my browser what syntax i have to use?

shabbir 10Feb2011 07:03

Re: php script from a browser
 
PHP scripts are run directly using the browser URLs

pein87 10Feb2011 09:21

Re: php script from a browser
 
You need to know the url variables. If you know that you can then add values to them. Example url

Code:

http://www.mysite.coom/index.php?uid=0000001&sid=1
after the php you need a question mark or ? . This can also be done with a html page to or pretty much any script file.Then the url variable follow by an equal sign or = . This says make this url GET variable have the value after the equal sign. If there is more then one url variable you need to add an and sign or &. You can also use & but most servers have it as & . The above url has two variables that will be sent to the script via GET. POST types aren't sent so they can be seen via the url. You'd need packet filtering for that. However most use REQUEST in php so it doesn't need to filter request types. Also php doesn't use strong type, they are more or less validating the data being passed as int and string because php does not support types unless your type casting.

the variables would be retrieved like so

PHP Code:

$user $_GET['uid'];
$session $_GET['sid']; 

or

PHP Code:

$user$_REQUEST['uid'];
$session $_REQUEST['sid']; 

lots of sites dont validate their GET data and sql injections happen.

mike_ledis 10Feb2011 14:21

Re: php script from a browser
 
Pein87 first of all thank you! Could you explain me more about post method? If my script uses a post method how can i change the variables. I tried to make a post form in my pc,that uses the full url of the script that i want as an action. But every time, the browser is trying to find the url in the root directory that i placed my script.//ex C:/Users/mikeb/Desktop/

lionaneesh 10Feb2011 19:43

Re: php script from a browser
 
Quote:

Originally Posted by mike_ledis (Post 79077)
Pein87 first of all thank you! Could you explain me more about post method? If my script uses a post method how can i change the variables. I tried to make a post form in my pc,that uses the full url of the script that i want as an action. But every time, the browser is trying to find the url in the root directory that i placed my script.//ex C:/Users/mikeb/Desktop/

For post Requests you have to make a HTTP request to the server page...
Another way of doing it is to simply make a simple form like :-

You can do this by using Firebug a great addon for mozilla

Code: html

<form action="page_where_you_want_to_post" method="POST">
<input name="argument1" type="text"/>
<input name="argument2" type="text"/>
<input name="argument3" type="text"/>
</form>



All times are GMT +5.5. The time now is 10:00.