Calculating the apparent magnitude of a satellite
This is for satellites with unknown size and orientation but known standard magnitude (Standard magnitude can be found on the satellite info page of heavens above, the number is called intrinsic magnitude)
The proper formula is 

            double distanceToSatellite = 485; //This is in KM
            double phaseAngleDegrees = 113.1; //Angle from sun-&gt;satellite-&gt;observer
            double pa = phaseAngleDegrees * 0.0174533; //Convert the phase angle to radians
            double intrinsicMagnitude = -1.8; //-1.8 is std. mag for iss


            double term_1 = intrinsicMagnitude;
            double term_2 = 5.0 * Math.Log10(distanceToSatellite / 1000.0);

            double arg = Math.Sin(pa) + (Math.PI - pa) * Math.Cos(pa);
            double term_3 = -2.5 * Math.Log10(arg);

            double apparentMagnitude = term_1 + term_2 + term_3;


This will give the apparent magnitude of the satellite.
Note: I gave the formula in C#