We present a numerical method to locate periodic orbits near homoclinic orbits. Using a method of [X.-B. Lin, Proc. Roy. Soc. Edinburgh, 116A (1990), pp. 295-325] and solutions of the adjoint variational equation, we get a bifurcation function for periodic orbits, whose periods are asymptotic to infinity on approaching a homoclinic orbit. As a bonus, a linear predictor for continuation of the homoclinic orbit is easily available. Numerical approximation of the homoclinic orbit and the solution of the adjoint variational equation are discussed. We consider a class of methods for approximating the latter equation such that a scalar quantity is preserved. We also consider a context where the effects of continuous symmetries of equations can be incorporated. Applying the method to an ordinary differential equation on R-3 studied by [E. Freire, A. Rodriguez-Luis, and E. Ponce, Phys. D, 62 (1993), pp. 230-253] we show the bifurcation function gives good agreement with path-followed solutions even down to low period. As an example application to a parabolic partial differential equation (PDE), we examine the bifurcation function for a homoclinic orbit in the Kuramoto-Sivashinsky equation.