PHP Script - How to track courier service using tracking number from my website.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • aveeva
    New Member
    • Apr 2019
    • 33

    PHP Script - How to track courier service using tracking number from my website.

    I need like,

    Track your packages in real-time with TrackCourier. Get instant updates on your shipment status.


    The customer chooses selected courier service and enters tracking id then clicks its redirect to the appropriate courier service website.

    eg: If tracking id 12345 the redirect link should be https://www.fedex.com/apps/fedextrac...&cntry_code=in

    How to do for India courier services?

    My code:

    Code:
    <!DOCTYPE HTML>
    <html>  
    <body>
    
    <form action="#" method="post">
    Select Courier :
    <select name="courier">
      <option value="">--Please choose an option--</option>
      <option value="professional_courier">Professional Courier</option>
      <option value="india_post">India Post</option>
    </select>
    
    Trackingid: <input type="text" name="trackingid"><br>
    <input type="submit">
    
    </form>
    
    
    
    <?php 
    if (!empty($_POST)): header("Location: https://www.tpcindia.com/Tracking2014.aspx?id=".$_POST["trackingid"]."&type=0&service=0");
    endif;
    ?>
    
    </body>
    </html>
    Now I have added only one courier service, how can i add more than one courier service URL
  • aveeva
    New Member
    • Apr 2019
    • 33

    #2
    Final Code :

    Code:
    <!DOCTYPE HTML>
    <html>  
    <body>
    
    <form action="#" method="POST">
    Select Courier :
    <select name="courier">
      <option value="">--Please choose an option--</option>
      <option value="professional_courier">Professional Courier</option>
      <option value="india_post">India Post</option>
    </select>
    
    Trackingid: <input type="text" name="trackingid">
    <input type="submit">
    
    </form>
    
    <?php
    if(isset($_POST['courier']))
    {
    	if(isset($_POST['professional_courier']))
    	{
    		if (!empty($_POST)): header("Location: https://www.tpcindia.com/Tracking2014.aspx?id=".$_POST["trackingid"]."&type=0&service=0");
    	}
    
    	else(isset($_POST['india_post']))
    	{
    		if (!empty($_POST)): header("Location: https://www.dhl.com/en/express/tracking.html?AWB=".$_POST["trackingid"]."&brand=DHL");
    	}	
    }
    ?>
    </body>
    </html>
    Any help, Thanks.

    Comment

    Working...