aveeva Posted November 29, 2019 Share Posted November 29, 2019 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? Quote Link to comment https://forums.phpfreaks.com/topic/309593-php-script-how-to-track-courier-service-using-tracking-number-from-my-website/ Share on other sites More sharing options...
requinix Posted November 29, 2019 Share Posted November 29, 2019 Note the tracking URL for the services you want to support. Most of them use GET, some use POST, some use POST but actually support GET too. Then insert the tracking code in the right spot. Quote Link to comment https://forums.phpfreaks.com/topic/309593-php-script-how-to-track-courier-service-using-tracking-number-from-my-website/#findComment-1571981 Share on other sites More sharing options...
aveeva Posted November 29, 2019 Author Share Posted November 29, 2019 https://www.fedex.com/apps/fedextrack/index.html?tracknumbers=12345&cntry_code=in From above how can i post customer entered input field to post after ?tracknumbers= Quote Link to comment https://forums.phpfreaks.com/topic/309593-php-script-how-to-track-courier-service-using-tracking-number-from-my-website/#findComment-1571982 Share on other sites More sharing options...
requinix Posted November 29, 2019 Share Posted November 29, 2019 Think. This is not a difficult question. I know you can find the answer. Quote Link to comment https://forums.phpfreaks.com/topic/309593-php-script-how-to-track-courier-service-using-tracking-number-from-my-website/#findComment-1571984 Share on other sites More sharing options...
aveeva Posted November 29, 2019 Author Share Posted November 29, 2019 @requinix Here is my 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> 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 Quote Link to comment https://forums.phpfreaks.com/topic/309593-php-script-how-to-track-courier-service-using-tracking-number-from-my-website/#findComment-1571987 Share on other sites More sharing options...
ginerjm Posted November 29, 2019 Share Posted November 29, 2019 Create a drop down list of the services. When the user picks one from the list go back to the php script with that choice and the id number and build the url from an array of them keyed by the items in that dropdown list. Then use a header() call to go to their website. Quote Link to comment https://forums.phpfreaks.com/topic/309593-php-script-how-to-track-courier-service-using-tracking-number-from-my-website/#findComment-1571988 Share on other sites More sharing options...
aveeva Posted December 3, 2019 Author Share Posted December 3, 2019 @ginerjm Can i get code help? I am newbie. Quote Link to comment https://forums.phpfreaks.com/topic/309593-php-script-how-to-track-courier-service-using-tracking-number-from-my-website/#findComment-1572112 Share on other sites More sharing options...
aveeva Posted December 4, 2019 Author Share Posted December 4, 2019 On 11/29/2019 at 7:40 PM, ginerjm said: Create a drop down list of the services. When the user picks one from the list go back to the php script with that choice and the id number and build the url from an array of them keyed by the items in that dropdown list. Then use a header() call to go to their website. My final 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. Quote Link to comment https://forums.phpfreaks.com/topic/309593-php-script-how-to-track-courier-service-using-tracking-number-from-my-website/#findComment-1572160 Share on other sites More sharing options...
aveeva Posted December 4, 2019 Author Share Posted December 4, 2019 Finally working, thanks to everyone. <!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> Quote Link to comment https://forums.phpfreaks.com/topic/309593-php-script-how-to-track-courier-service-using-tracking-number-from-my-website/#findComment-1572162 Share on other sites More sharing options...
Barand Posted December 4, 2019 Share Posted December 4, 2019 You don't have anything in you input form with the name = "professional_courier" or name = "india_post", so $_POST['professional_courier'] and $_POST['india_post'] never exist. You should, therefore, be seeing messages that those $_POST indexes do not exist. If not, turn on your error reporting so you are not continually stabbing in the dark. Quote Link to comment https://forums.phpfreaks.com/topic/309593-php-script-how-to-track-courier-service-using-tracking-number-from-my-website/#findComment-1572163 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.