Yes you can use solar panels for solar heating, but it's not recommended. Powering your hot water, floor heating or space heating with PV would be inefficient and rather expensive, and there are good alternatives..
Technically you could use solar panels to generate electricity, and then power your water boiler with this energy.
It is not recommended because it would require a significant investment in solar panels and the cost of installing such a large solar power system, capable enough to run a boiler, will be remarkably higher than to run it from the grid power.
What are the limitations of solar systems?
When you’re planning to invest in a cost effective solar system, it’s important to understand that solar systems have their limitations. While it is an excellent option to power smaller loads, larger loads tend to increase the size of the solar array, and hence your upfront expenditure of the overall power system.
In case you have access to the grid, you should calculate if grid power or solar power is the most economical investment to power your hot water or space heating. Usually for residential projects, the best use of solar generated electricity is to power small household loads, appliances and energy efficient lighting.
Solar heating: solar water heater
Use solar thermal energy for your heating needs
An excellent alternative to PV energy, is to heat your hot water or floor is to do solar heating with the help of solar thermal panels.
Solar thermal is a mechanism which directly utilizes solar heat energy to heat water or air and is more efficient than using a solar panel for such applications.
In general, all solar water heating systems has a solarcollector which absorbs solar heat energy. This heat, depending upon the system, is either transmitted to the water to heat it or to another circulating fluid which heats the water and circulates it around the house.
Investing in solar thermal collectors will prevent you from oversizing your solar array, just for the purpose of heating your hot water. Both for on- and off-grid solar system, the solar thermal panels are a good complementary product for solar heating to install on your roof.