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 7 years ago.
Improve this question
I'm using a plugin that updates alsmost evert week, and when that happens it overrides every work that I've done. I welcome the updates but not when it overrides my inputs. I'm trying to keep my inputs in seperate file and have a code in place that will find the pluging file and include my inputs as a file. That way nothing will break, my inputs and the updates will both be intact. my code looks like below.
$useThis = 'search-processor.php';
$putHere = "um-actions-members.php";
file_put_contents($useThis, $putHere, FILE_APPEND | LOCK_EX);
This way you will not parse the PHP commands, you only include what is inside the php file
$useThis = "search-processor.php";
$putHere = "um-actions-members.php";
// get the content of $putHere
$fileContent = file_get_contents($putHere);
file_put_contents($useThis, $fileContent, FILE_APPEND);
To parse the PHP commands you need to go inside the $useThis and use the include command, like
include("um-actions-members.php");
Related
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.
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
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
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
How can i create new page on my website using PHP? I need PHP-code, which can create a new page. For example, i've got index.php and i need to create index2.php w/ PHP. Thanks.
Like above answer you can use fopen() and fwrite() to build a new .php file, or you could try using file_put_contents() which would also generate a new file if it doesn't exist.
file_put_contents($filename, $content);
Example
$filename = "index2.php";
$content = "<h1>hello world</h1>";
file_put_contents($filename, $content);
Use fopen() to create a file, and fwrite to edit it, more info here :
http://www.w3schools.com/php/php_file_create.asp
Open Notepad (if your do not have any other softwares like Notepad++ or Dreamweaver for editing PHP code), write your code there, Save the text file with .php extension in the same directory where your index.php file is located.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
Hello, I Was wondering if there was a way to use php to call on a css file and insert data into it. The purpose would be to to allow a user to easily modify a css file instead of having to go into the file manually. It would be a field called Width: with a text area for them to enter it in.
Sure. You can easily read a file with file_get_contents and then write it back to the file with file_put_contents.
// load the css file into a string
$css = file_get_contents("my.css");
// make changes, e.g....
$css = str_replace("width: 10px;", "width: 20px;", css);
// save those changes
file_put_contents("my.css", $css);
Create an script to "generate special css" using functions like fwrite() that will create an special css for each user and then load it if user is logged to overwrite the original css