How to make my code run on link [closed] - php

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I have php script, I can run this script with php.
But i want make this script without edit the SESSION AND TOKEN and CAN run on browser with link.
So here go:
My script coin.php
I must edit this script to make this code work.
$get->session = "MYSESSION";
$get->token = "MYTOKEN";
Nah my question is, Can I run this php script WITHOUT edit the php BUT I must edit with LINK
Example: > http://www.example.com/coin.php?session=MYSESSION&token=MYTOKEN
What code should be added on my sript? I want run this script with link
I hope you understand
Thank you so much

to access: http://www.example.com/coin.php?session=MYSESSION&token=MYTOKEN and use the query string values, your code should be:
$get->session = $_GET['session'];
$get->token = $_GET['token'];
see http://php.net/manual/en/reserved.variables.get.php for further information

Related

what does $_GET['2020'] mean? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
a challenge like this $_GET['2020'] snippet boring me a long time, i want to know how this work, but do not know which keywords to search, maybe how the parameter works?
$_GET reads querystring parameters from the URL. So if someone goes to your PHP script with a URL like http://servername/scriptname.php?2020=ABC then when the PHP script runs, the variable $_GET['2020'] will contain the value ABC.
More info is available in the documentation: https://www.php.net/manual/en/reserved.variables.get.php

Make a page with a parameter same as a page without parameter [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I am trying to make this page:
https://mediastreet.ie/media-jobs/role-65678
same as this page using htaccess:
https://mediastreet.ie/media-jobs/role
So basically /role-65678 is a parameter like role-{parameter}. So when on /role-65678 i have a script that fetches this (65678) and displays the job according to it.
Rather than editing your htaccess file, I would just reccomend sticking with a good old get method.
Use https://mediastreet.ie/media-jobs/role?id=65678
Then in the index.php file in the directory "role", use the get functionality as shown below.
<?PHP
$id = $_GET["id"];
//Code to follow
?>
Past experiance tells me this will save alot of htaccess headaches!
All the Best.

Can i hit an endpoint and get/echo the <body>? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I currently don't even know what exactly to search, don't know if that procedure has a name or something, that's why i decided to post a question.
For example, when i hit mysite/test.php i want that php to make a request to another .php on another server and get all the html contents of that page and echo it in test.php, is that even possible?
Let's suppose test.php is that php file which makes a request to take_me.php .
take_me.php could have just an echo or it could be a full content page.
Can i have the content of take_me.php shown in test.php?
You could use file_get_contents and echo to screen like below:
$html = file_get_contents('http://www.google.com');
if (isset($html)) {
echo $html;
}
You may have issue with images rendering correctly etc... due to paths but it will work.
http://php.net/manual/en/function.file-get-contents.php

Why does the function require_once prevent my code from working [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
At the top of my code I have the following
require_once 'PSBE_LOGIN';
where PSBE_LOGIN has all the information to access my database(I'm using a PDO connection). However, my code does not work but when I take it out, my code works perfectly. Any thoughts on why this is? I need the file there so I can collect information from my database.
Require (as opposed to include) will halt the execution of a script on failure. For example, if the specified file is not found.
Thus your code can be fixed by ensuring the file exists and in the correct directory.
Hi try this ( no quotes )
require_once PSBE_LOGIN;

How to execute bash script with PHP? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I have a bash script which I want to take a parameter, it all works fine normally so that is not the issue.
What is I want is an HTML (or PHP if need be) which will take text entered into a text field and execute a bash script with it as a parameter.
I had my HTML working last night with some embedded PHP (I didn't attempt to pass argument at this stage):
<?php
exec("/scriptname.sh");
?>
This however would simply not execute the script (yes it is located at /). I had a simple "echo test > testfile" command which obviously did not run.
What is the easiest way to do what I need, and an example would also be great.
Thanks a lot for taking the time to read this.
have a look on shell_exec
$output = shell_exec('/scriptname.sh p1 p2 p3');
Documentation
http://www.php.net/shell_exec

Categories