As already mentioned in the comments, you could parse the HTML from the web page and extract the node ID from a class value.
But that's very messy, and it'll break if Drupal.org changes its markup for node pages.
A more robust approach would be to use the API, and consume the project's update feed. That feed contains the raw URL of the project node, from which you can get the ID.
I'll leave the PHP implementation to you, but the steps are as simple as:
I realise that method also relies on the XML not being changed, but I think that's less likely to change than the markup on the HTML version.