Shares rise on foreign buying