Skip to content

A lightweight PHP script to forward GET and POST requests, including JSON, to any target URL. Ideal for payment gateways and HTTP redirection.

License

Notifications You must be signed in to change notification settings

BaseMax/payment-gateway-forwarder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Payment Gateway Forwarder

License: MIT

Payment Gateway Forwarder is a lightweight PHP script that forwards HTTP requests to a target URL. It supports both GET and POST requests, including JSON payloads, and can be used to simplify interactions with payment gateways or any external HTTP service.

This script handles:

  • GET requests by redirecting to the target URL.
  • POST requests with form data by automatically submitting an HTML form.
  • POST requests with JSON payloads by sending them directly via cURL.

Installation

  1. Clone this repository or download the index.php file:
git clone https://github.com/BaseMax/payment-gateway-forwarder.git
  1. Place index.php in your web server directory.

  2. Make sure your server supports PHP 7.4+ (or higher) and cURL.


Usage

Forward a GET request

GET /index.php?url=https%3A%2F%2Fexample.com%2Ftarget

This will redirect the client directly to the target URL.

Forward a POST request

  1. Form submission (application/x-www-form-urlencoded):

Send a POST request to index.php with a url parameter and any form fields. The script will generate a hidden HTML form and automatically submit it to the target.

  1. JSON submission (application/json):

Send a POST request with Content-Type: application/json:

curl -X POST "https://yourdomain.com/index.php?url=https%3A%2F%2Fexample.com%2Ftarget" \
     -H "Content-Type: application/json" \
     -d '{"amount":100,"currency":"USD"}'

The script will forward the JSON payload to the target URL and return the response with the correct HTTP status code.


Security Considerations

  • Ensure the url parameter is validated before use in production.
  • Avoid exposing this script publicly without access control to prevent misuse.
  • Only forward requests to trusted endpoints.

License

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


Author: Seyyed Ali Mohammadiyeh (Max Base)

License: MIT

Copyright: 2025

Happy forwarding! 🚀

About

A lightweight PHP script to forward GET and POST requests, including JSON, to any target URL. Ideal for payment gateways and HTTP redirection.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages