Simple Online/Offline Script Help Needed

That is exactly it.
Your new url will be:

$newurl = $url . "&client_id=" . $clientid;

This is known as sending the client ID as a parameter.
One can also send it as a header, which is the preferred method, but this works just as well.