Salamah bin Wahram said: I heard Tawus (may Allah have mercy on him) say that the Messenger of Allah (peace and blessings be upon him) said: "When one of you comes to relieve himself, let him honour the qiblah of Allah: let him neither face it nor turn his back to it. Then let him clean himself with three stones, or three pieces of wood, or three handfuls of earth. Then let him say: 'Al-hamdu lillahil-ladhi akhraja 'anni ma yu'dhini wa amsaka 'alayya ma yanfa'uni' (All praise is for Allah, who removed from me what harms me and retained for me what benefits me)."
Ahmad bin al-Hasan al-Mudari, who narrated it from Abu Asim from Zam'ah, is a liar and matruk (abandoned). Neither its connection (through Ibn Abbas) nor its attribution to the Prophet (peace and blessings be upon him) is authentic.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الطهارة / 538