With PHP, Can I POST Directly to Text File? [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 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.

Related

Is there a variable in which the console output is stored? (Codeception) [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
Is there a variable in which the console output is stored?
If I have this variable I can save it in a file and open it later.
Not to my knowledge.
The codecept_debug() function exists for this reason: Codeception basically takes over stdout, and only data sent through this function will appear in your test output.
The best I could suggest would be to have your test process send everything it outputs to a file for you to consult later. If you go that route, you'll probably want to disable the colors setting in your Codeception configuration (see related documentation).

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

PHP $_FILES file details [closed]

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 8 years ago.
Improve this question
It might be a strange question but I am asked if it is possible and I don't know the answer.
In Windows it is possible to add details to a file, like an author and labels etc.
Is there any way in PHP I can read these details when this file is uploaded to the server (our client would like to use it to tag files on their server).
That information you mention it's called metadata.
You can use this php library to do the trick.
http://getid3.sourceforge.net/
Out of the box functionality doesn't pass this information when uploading files using PHP.
The documentation for $_FILES shows all of the details you can get about the file

How can I transfer http header to another page? [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
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.

Form for Uploading Files to Web Server [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
I want to create a form inside a PHP file that will allow me to type in a couple text fields and then upload those fields to certain tables/columns in my database. I can figure this out, but another option I want is to upload a song and upload an image to my webserver and then retrieve the link and upload those links to the database..
Does anyone know of a good tutorial for this?
You can find information on the php page.
Here is the link for upolading files information.
http://php.net/manual/en/features.file-upload.php

Categories