I tried using a photogrammetry tool for Blender but it was way too strict about telling it where horizontal lines were in the photo (2 for X, 2 for Y to calculate the match and then I think it assumed they intersect at 0,0 so had to be in the same vertical plane) so it only really worked on photos of buildings.
Now I just do it on full manual, move/rotate the camera until it's close enough to help with the feature I'm working on. Generally I start by putting the 3d cursor on a point I can see in the photo, then rotating/scaling around that point and if it doesn't fit I tweak the fov and try again. I found a GIMP plugin that can undo barrel/etc. distortion of known cameras so I also have the option of using that if a photo has full EXIF data, likewise if the EXIF data has accurate focal length I can just set it (I found that for example iphones only list this as a whole number and their sensor size is so small it's useless, eg. you'll get 4mm focal length 6mm sensor, meaning it's actually somewhere 3.5-4.5 which is a huge range of fovs)
Some internet photos work fine, some just have no chance of matching up, I imagine it's due to various cropping/scaling choices that don't make it into EXIF. I find it's not really worth trying to compensate for that sort of thing, way too many degrees of freedom. If a photo's not working just move on.