First of all i would suggest to get your son examined by a physician or a surgeon. As per the histoty given by you and as you have yourswlf noticed very correctly that your child has pain and bleeding when he passes hard stools. This may well be due to some anal problem as fissure for which he needs to be examined. Meanwhile give your kidplenty of water and high fibre diet as leafy green vegetables, fruits, salads and milk. Your doctor may advice some local ointment to apply.
Please do not give over the counter medication
without having your child examined by a doctor
Wishig a speedy recovery to your child