File: linuxfront-v2-logistics/pierbridgeTrack.php
A lightweight PHP proxy for embedding Pierbridge tracking details within the FreightAnywhere “Logistics” portal. It fetches remote tracking content based on query parameters and applies minimal CSS tweaks for seamless integration.
Overview
This script acts as a bridge between the front-end and Pierbridge’s tracking service. Upon receiving specific query parameters, it:
- Constructs a target URL
- Retrieves the remote content
- Outputs it directly to the client
- Applies inline CSS to hide unwanted elements
Purpose
- 🔗 Proxy external content
- 🛠️ Simplify integration with Pierbridge
- 🎨 Customize styling by removing default titles and links
How It Works
- Read GET parameters:
url,contentType,trackingNumber - Build the request URL by concatenating parameters
- Fetch remote data using
file_get_contents() - Echo the response back to the browser
- Inject inline CSS to hide
.Titleand.OpenLinkelements
<?php
// print_r($_GET); exit; // Uncomment for debugging
$url = $_GET['url']
. "&contentType=" . $_GET['contentType']
. "&trackingNumber=" . $_GET['trackingNumber'];
echo file_get_contents($url);
?>
Query Parameters
| Parameter | Description | Required |
|---|---|---|
| url | Base endpoint of the tracking service | Yes |
| contentType | Type of content expected (e.g., html, xml) |
Yes |
| trackingNumber | Shipment’s tracking or pro number | Yes |
Inline Styling
<style type="text/css">
.Title { display: none !important; }
.OpenLink { display: none !important; }
</style>
- .Title removes default page headers
- .OpenLink hides “Open in new window” links
Usage Example
Assuming your front-end calls this script as an <iframe> or AJAX:
/pierbridgeTrack.php?
url=https://pierbridge.example.com/track
&contentType=html
&trackingNumber=123456789
The script then proxies the HTML response from Pierbridge and strips out the unwanted elements.
Security Considerations ⚠️
- Server-Side Request Forgery (SSRF)
Unvalidatedurlinput can allow requests to internal services. - Input Validation
Always sanitize or whitelist theurldomain. - Error Handling
file_get_contents()may returnfalse; consider adding error checks.
Integration Tips
- Embed via
<iframe>for isolation. - Pass all parameters via HTTPS to protect confidentiality.
- Combine with back-end caching to reduce upstream load.
By centralizing the Pierbridge tracking fetch in a single script, this file keeps front-end code clean and offers a simple customization point for styling and security.