Giter Club home page Giter Club logo

docker-php-request-logger's Introduction

Docker PHP Request Logger

Docker Ubuntu PHP

This repository contains a PHP script that logs all incoming HTTP requests along with their headers and request data ($_REQUEST). This can be useful for debugging or monitoring purposes in web applications.

Getting Started

To use this request logger, follow these steps:

  1. Clone this repository to your local machine:

    git clone https://github.com/tshenolo/docker-php-request-logger.git
  2. Navigate into the cloned directory:

    cd docker-php-request-logger
  3. Build the Docker image using the provided Dockerfile:

    docker build -t request-logger .
  4. Run the Docker container:

    docker run -d -p 8080:80 request-logger

    This will start the PHP script inside a Docker container accessible at http://localhost:8080/.

  5. View logs:

    docker logs <container_id_or_name>
  6. Access the container:

    docker exec -it <container_id_or_name> /bin/bash
  7. Stop container:

    docker stop <container_id_or_name> 
  8. Remove image

    docker rmi -f <image_id_or_name> 

Usage

Once the Docker container is running, you can send HTTP requests to the server, and the script will log them along with the headers and request data. The logs can be viewed using the command: docker logs <container_id_or_name>.

Examples:

curl -X GET \
-H "Content-Type: application/json" \
-H "Authorization: Bearer my_token" \
http://localhost:8080/index.php?key1=value1&key2=value2
curl -X POST \
  -H "Content-Type: application/json" \
  -d '{"key1": "value1", "key2": "value2"}' \
  http://localhost:8080/index.php

Contributing

If you have suggestions or improvements, feel free to open an issue or create a pull request. Contributions are welcome!

License

This project is licensed under the MIT License - see the LICENSE file for details.

Thank you for the Support

  • ⭐ Give this repo a ⭐ star ⭐ at the top of the page
  • 🐦 Follow me on twitter twitter
  • 📺 Subscribe to my Youtube channel

docker-php-request-logger's People

Contributors

tshenolo avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.