You cannot apply online from your home country.
You have two options. The first option is to get a TRV (tourist visa) to Canada. You will then have to travel to Canada and claim asylum once you arrive here. The second option is to move outside of Pakistan. Once you are living outside of Pakistan, you would need to be officially recognized as a refugee by UNHCR or a similar referral organization.