You can flank with ranged weapons
It's not even hard. It even almost makes sense, and it certainly makes more sense than most of the rules in Pathfinder. The most important part of the flanking rules linked in the question is:
When in doubt about whether two characters flank an opponent in the middle, trace an imaginary line between the two attackers' centers. If the line passes through opposite borders of the opponent's space (including corners of those borders), then the opponent is flanked.
This tells you how to tell if you flank someone. If they are in-between you and your buddy, they're flanked. Next we get some exceptions to this:
Exception: If a flanker takes up more than 1 square, it gets the flanking bonus if any square it occupies counts for flanking.
Only a creature or character that threatens the defender can help an attacker get a flanking bonus.
Creatures with a reach of 0 feet can't flank an opponent.
Do any of these pertain especially to ranged weaponry? Yes, the second one does. Ranged attackers usually don't threaten spaces, so they usually can't help other people count as flanking an opponent when attacking. I say usually here because of things like Snap Shot. But even without the ability to threaten an opponent you can still flank them-- The second exception says nothing about the attacker, only about who can help him or her.
An example to illustrate:
When fighter X attacks gnoll G he does not count as flanking G because, while archer A is behind the gnoll in such a manner as would ordinarily constitute flanking, A does not threaten G, and so can't help with flanking.
When archer A attacks gnoll G he does count as flanking because fighter X does threaten the gnoll (and the position is equivalent).
Note: If A has Improved Snap Shot then when X attacks he counts as flanking because A then threatens G and can help.
What do you get for flanking with a ranged weapon?
Ordinarily, nothing. I mean, it's a decent tactical position and your GM will probably RP the enemies as overwhelmed, but you don't get any bonuses or anything. That's what that first quoted line is saying: You (only, as far as I can tell) get a +2 flanking bonus to hit on melee attacks only, and never on ranged attacks. In fact, the line itself doesn't even imply the second part: it's just that nothing else in the rules does give ranged attacks a flanking bonus to hit, so you can't get one.
However, lots of characters, especially rogues, care about flanking for reasons other than the measly +2 bonus to hit. Anything that references 'flanking' references the condition, not the bonus, and you can legally and semi-intuitively gain that condition with respect to an enemy with a ranged weapon.