is file_get_contents logged??

Alles, was PHP betrifft, kann hier besprochen werden.

is file_get_contents logged??

Postby alexkrups » 14. November 2015 23:57

Hello ! I have been looking for this everywhere but i can not find an answer online.

I have built a script that builds post data with HTTP build query and then posts it using file_get_contents.
Does anyone know if this information is logged anywhere onto the server or Apache please?
Alex Krups
Carpe diem
alexkrups
 
Posts: 3
Joined: 14. November 2015 23:50
Operating System: Windows 7 ultimate

Re: is file_get_contents logged??

Postby Nobbie » 15. November 2015 14:22

alexkrups wrote:Does anyone know if this information is logged anywhere onto the server or Apache please?


No, it is not logged. Anyway, i wonder how to POST(!) contents via a GET (file_get_contents())?? "POST" means sending Output via a TCPIP socket like writing contents via a file handle. How to POST contents in a file_get_contents() call?
Nobbie
 
Posts: 13165
Joined: 09. March 2008 13:04

Re: is file_get_contents logged??

Postby alexkrups » 15. November 2015 15:01

Code: Select all
function writeit($data,$site) {
   $data = array('info' => $data);
   $options = array(
      'http' => array(
         'header'  => "Content-type: application/x-www-form-urlencoded\r\n",
         'method'  => 'POST',
         'content' => http_build_query($data),
      ),
   );
   $context  = stream_context_create($options);
   $result = file_get_contents($site, false, $context);   
}



This is the script I am using , you fetch data to the url ... it does the job for me :)
Alex Krups
Carpe diem
alexkrups
 
Posts: 3
Joined: 14. November 2015 23:50
Operating System: Windows 7 ultimate

Re: is file_get_contents logged??

Postby Nobbie » 15. November 2015 15:36

I have never worked with the stream socket functions. Instead i prefer fsockopen().

Anyway, neither fsockopen nor file_get_contents() are logged. You have to create your own "logging" (debugging). Maybe there is an option inside the stream socket functions, but Apache does not recognize the traffic from PHP. You could even run this script in a non-Server (Apache) environment, i.e. not in a HTTP context.
Nobbie
 
Posts: 13165
Joined: 09. March 2008 13:04

Re: is file_get_contents logged??

Postby alexkrups » 15. November 2015 16:59

Thanks for the logging info. I was interested in not logging the data , so I am happy.
Alex Krups
Carpe diem
alexkrups
 
Posts: 3
Joined: 14. November 2015 23:50
Operating System: Windows 7 ultimate

Re: is file_get_contents logged??

Postby Nobbie » 16. November 2015 12:14

alexkrups wrote:Thanks for the logging info. I was interested in not logging the data , so I am happy.


But keep in mind, that (of course!) the remote server may log this request.
Nobbie
 
Posts: 13165
Joined: 09. March 2008 13:04


Return to PHP

Who is online

Users browsing this forum: No registered users and 45 guests