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

  1. Read GET parameters: url, contentType, trackingNumber
  2. Build the request URL by concatenating parameters
  3. Fetch remote data using file_get_contents()
  4. Echo the response back to the browser
  5. Inject inline CSS to hide .Title and .OpenLink elements
<?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)
    Unvalidated url input can allow requests to internal services.
  • Input Validation
    Always sanitize or whitelist the url domain.
  • Error Handling
    file_get_contents() may return false; 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.