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
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 5 years ago.
Improve this question
I have a page 'Error 404' and the address is like http://myurl.com/error404
the php file of error404 require's the index.php to properly show it.
I need a php code that will load or show the content in the url above without redirecting/changing the url. thanks
echo file_get_contents("http://myurl.com/error404");
Works also for URLs.
DOCS
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 8 years ago.
Improve this question
I would like to know if it is possible to transfer a defined header to another page. For example in PHP, I want to send http header value to a new page.
I don't know if it's possible. PHP or JavaScript is fine.
Yes, you can. Let's say you have some data that you want to send to another file via HTTP, you could do something like I have shown below.
FirstFile.php
<?php
$someVar = "SomeValue";
header("Location: SecondFile.php?someVar=" . $someVar);
?>
So, in the above code, you learn how to transmit data to a new file, now to retrieve and utilize that data, you should do the following as I have done.
SecondFile.php
<?php
$someVar = $_GET['someVar'];
?>
You use the $_GET to achieve this. You can know more about this here.
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
I know that the usual method for handling a form with PHP is to POST to a script like this:
echo("<form action='handleForm.php' method='post'>");
it possible to POST directly into a text file like this:
echo("<form action='formData.txt' method='post'>");
?
If you want to append the text into the file, it won't.
POST is a type of request to the server to send data. HTTP server will answer with your txt file, and the browser will show that. As the server as default is not able to run any kind of txt codes, nothing will happen. You can set up different codes, how to handle these files.
There are a lot of types of request, read further if you interested in.