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

I need like,

http://www.trackcourier.in/

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/fedextrack/index.html?tracknumbers=12345&cntry_code=in

How to do for India courier services?

<!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>

How to track more than one service, now my code track only one service, how can i add india post if customer choose india post courier service url: https://www.indiapost.gov.in/_layouts/15/dop.portal.tracking/trackconsignment.aspx

Show us a VALID India Post tracking URL…

and any other ‘service’ you want t use as well…

Given url is valid india post url.

This youre saying?

https://www.indiapost.gov.in/_layouts/15/dop.portal.tracking/trackconsignment.aspx

Really? Where does the tracking number go in the URL then?

Seems to bring you just to page where you ENTER in the tracking number.

@whispers

FYI India post has captcha validation on the tracking page, it’s not possible to add tracking on the URL. I just lead customer go to india post tracking page. I have DHL service also,

https://www.dhl.com/en/express/tracking.html?AWB=7986416524&brand=DHL Tracking code available after AWB=.

I guess I’m not clear on your question then.

You gave an example link for FEDEX… then asked how to do it for India courier services?

Then, now, you say India has CAPTCHA, and its not possible.

What is the real question here?

@whispers

Let me explain. I have a website, customer place order and chooses the courier service. In my website 5 courier services integrated customer chooses their cost convenient service. After placed order customer gets a tracking number. If customer tracks their parcel every time go to third party courier service website and enter tracking id. Now i need to simplify the process, using PHP script customer select dropdown courier service and enter the tracking id if click track button the link redirect to courier service tracking page same as tracking id applied page.

What is an error in below 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>

Finally working, thanks

<!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 ('professional_courier' === $_POST['courier']) {
			header("Location: https://www.tpcindia.com/Tracking2014.aspx?id=" . $_POST["trackingid"] . "&type=0&service=0");
		} else if ('india_post' === $_POST['courier']) {
			header("Location: https://www.dhl.com/en/express/tracking.html?AWB=" . $_POST["trackingid"] . "&brand=DHL");
		}
	}
	?>
</body>

</html>
Sponsor our Newsletter | Privacy Policy | Terms of Service