How to extract a specific form element from an external site?

I am new to php, api and web development. I will try my best to explain the scenario here.
There is this website (a courier company site) who let their customer track their parcels through reference number and when you input the number, click on Track button, it shows the status of the parcel on next page.
I want to duplicate it on my webpage. I created a form with a button. Now I need that POST URL (endpoint) and correct id element to send that request to that “specific php file” and I can get the data returned through json and show it on my webpage.

How can I reverse engineer it to get those information? As I don’t have access to its php code.

You need to go and speak to the courier company to ensure you are allowed to do any of this.

Surely, you just link to the tracking number on their website.

If the courier\supplier has a decent API, you might be able to get status updates, but this will be something the supplier needs to provide. It’s doubtful that you will be able to re-create this using the core site, it would be a separate and locked down API.

The core website\API will almost certainly have measures\security in place stopping you from doing what you’ve explained above.

Courier company does not have API at all and I have seen many website in Google search below the official site doing the same thing (tracking status through parcel number). How would they pulled it off then? Any idea?

If courier company allows to use the API you can check with them to get the request and api structure.

You can also use Chrome network tab to track the API request and response.

Note: Some organizations have restrictions on using it

Hello, I am not sure if this exactly what you’re looking for but you can try this, go to https://trackcourier.io/ and select the courier service and tracking number. Check how they are showing the results in the browser console.

Now to have similar functionality on your form:

  1. Call POST API endpoint to get the request payload as response by passing the courier service and tracking number
    https://trackcourier.io/api/v1/get_checkpoints_table/e545919dd175e578588b63a5d1f0da15/ups/5548789114
  2. Pass the response from Step 1 to this POST API endpoint - https://tcio.dev/api/tap/hit



Thanks,
MJ.