It is of course okay to use Fermat's Little Theorem, but it can be done by an even more elementary argument. Saying your $p$ divides the number, say $mp$, formed with $k$ digits $1$ means that $10^k=9mp+1$, so one searches $k$ such that $10^k\equiv1\pmod{9p}$. Now $9p$ is coprime to $10$ if $p$ is, which implies that mulitplication by $10$ is an invertible operation on integers modulo $9p$ (you can find a multiplicative inverse of $10$ using Euclid's algorithm, but its existence is all that matters). Now imagine writing the powers $10^0=1,10^1,10^2,\ldots$ reduced modulo $9p$ until the first time some number (more precisely some class modulo $9p$) already present re-appears. If that number were not $1$, then inverting the multiplication by $10$ on the two equal numbers immediately gives a contradiction, so it is in fact the number has to be $1$. This gives your $k$.
So you don't have to use the catch-all exponent $\phi(9p)$ (the order of the group) that will work for all invertible elements modulo $9p$ at once. However in practice, when $9p$ is large but not so huge that you have difficulty calculating $\phi(9p)$, it helps a lot, if your goal is to explicitly find the least possible $k$, to know that it has to divide $\phi(9p)$.