Yes, you would have to query an external script to retrieve the public info from the other side of the router. There are plenty of websites to get the IP (http://whatismyip.com, http://iplookup.flashfxp.com, etc) but I have never seen one that reports both the IP and Port, they usually only report the IP. Most NATs use a 1-to-1 relationship on ports, though they CAN use different ports. If you have your own website (or have a friend that does), it would not be very difficult to write your own script to retrieve the public port.
If you make an OUTBOUND TCP connection from your LAN PC through the router to the outside, then the router generates and keeps track of the necessary NAT lookup info automatically so it can then forward traffic back and forth for that connection.
If you make an INBOUND TCP connection from the outside through the router to your LAN PC, there is no NAT lookup info established automatically. The router needs to be told ahead of time, via a Port Forwarding rule, which private LAN IP:Port to direct an incoming connection to when it receives a new client connection on a specific public IP:Port. If your router supports uPNP (and if it is enabled) then your app can use a uPNP API/library to programmably create a Port Forwarding rule in the router when the app opens a listening socket. Otherwise, if uPNP is not available then you have to configure the router manually instead.