Visitors from Iceland, Maldives, Nepal, Tonga, Trinidad and Tobago and Western Samoa do not need a visa, everyone else needs to visit an embassy or consulate. You will need to fill out a form, pay about $30 to $160 and provide some photos.
There have been reports of a small number of tourists being able to enter Pakistan without a visa. We don't have any concrete information but it might be worth a shot. Don't blame us if it doesn't work and you spend hours/days wasting your time.
You can NOT obtain a visa on arrival at the chinese border.
Pakistan Visa information
Foreign Affairs Pakistan