There are just a couple of connections. Here’s a pymel code example, which assumes you have a locator1 and curve1…
import pymel.core as pm
crv = pm.PyNode('curve1')
loc = pm.PyNode('locator1')
cpoc = pm.createNode('closestPointOnCurve')
crv.worldSpace[0] >> cpoc.inCurve
loc.worldPosition[0] >> cpoc.inPosition;
print cpoc.paramU.get()
You can run that, then have a look in the node editor to see the connections.
David
edit: Just noticed you asked about the nearestPointOnCurve. The one I showed above is in the bonusTools and has some extra data, but essentially the nodes work the same way. Slightly different attribute names.
import pymel.core as pm
crv = pm.PyNode('curve1')
loc = pm.PyNode('locator1')
cpoc = pm.createNode('nearestPointOnCurve')
crv.worldSpace[0] >> cpoc.inputCurve
loc.worldPosition[0] >> cpoc.inPosition;
print cpoc.parameter.get()