Where CIDs.txt is a file with the CIDs of interest, one per line.
edit: pay attention to NCBI limits:
Request Volume Limitations
All PubChem web pages (or requests to NCBI in general) have a policy
that users should throttle their web page requests, which includes
web-based programmatic services. Violation of usage policies may
result in the user being temporarily blocked from accessing PubChem
(or NCBI) resources. The current request volume limits are:
No more than 5 requests per second.
No more than 400 requests per minute.
No longer than 300 second running time per minute.