Can a Muslim fast and pray for the purpose of supplication?

The other question is can one go to the Al Haram to pray for one's needs, e.g to pray for cure from sickness , to pray to have children etc. Still can one fast for some days for the purpose of requesting for one's needs from Allah for the reasons stated above? (i.e. to pray for children etc).

Praise be to Allaah.
There is no reason why a Muslim should not pray in al-Masjid al-Haraam for the purpose of supplication, but it is better for him not to restrict his intention in the prayer to supplication. Rather his intention should be to worship Allaah through this prayer and to hope for its reward in the Hereafter. Moreover, prayer includes dhikr, reciting Qur’aan, bowing, prostrating and du’aa’, so the du’aa’ should just be a part of the prayer; it is not the primary purpose. Al-Masjid al-Haraam is one of the blessed and venerated places, so if a person prays and calls upon Allaah whilst prostrating, for example – then he will have combined the virtue of the place with the virtue of the action. If this is done during the last third of the night, he will also add the virtue of the time.

Shaykh al-Islam Ibn Taymiyah said:

With regard to the words of the Prophet (peace and blessings of Allaah be upon him), “As for rukoo’, glorify your Lord therein, and as for sujood (prostration) strive in du’aa’ therein, because then it is more likely that you will be answered” (narrated by Muslim, 479, from the hadeeth of Ibn ‘Abbaas) – this contains the command to glorify Allaah in rukoo’, and the command to make du’aa’ when prostrating indicates that du’aa’ in sujood is more likely to be answered than in rukoo’. Hence he said, “because then it is more likely that you will be answered”. And he said, “The closest that the slave is to his Lord is when he is prostrating.” (Narrated by Muslim 482 from the hadeeth of Abu Hurayrah). This is a command that du’aa’ should be made in sujood.

Majmoo’ al-Fataawa, 22/378

And he said:

Du’aa’ is answered when rain is falling, when battle in joined, when the adhaan and iqaamah are given, following prayers, when prostrating, and when offered by one who is fasting, one who is travelling and one who is oppressed, and so on. All of this is narrated in well-known ahaadeeth in the books of Saheeh and Sunan. Du’aa’ is also likely to be answered in the sacred places such as ‘Arafah, Muzdalifah, Mina, the Multazim and other sacred places in Makkah, and in the mosques in general. The greater the virtue of the mosque – such as the three Sacred Mosques [in Makkah, Madeenah and Jerusalem] – the better prayers and du’aa’s are in them.

Majmoo’ al-Fataawa, 27/129-130

On the other hand it may be said:

Doing righteous deeds in the hope that du’aa’ will be answered is something that is prescribed in sharee’ah. Hence doing wudoo’ and praying in al-Masjid al-Haraam may be included among the righteous deeds that may be done before starting du’aa’ in the hope that that the du’aa’ will be answered.  

It was narrated from ‘Uthmaan ibn Hunayf that a blind man came to the Prophet (S) and said: Pray to Allaah to heal me. He said, “If you wish, you may delay the reward until the Hereafter, for that is better, or if you wish, I will make du’aa’ for you.” He said, Make du’aa’. So he told him to do wudoo’ and do it well, and to pray two rak’ahs, and to say this du’aa’: “Allaahumma inni as’aluka wa atawajjahu ilayka bi Muhammadin Nabi al-rahmah. Yaa Muhammad inni qad tawajjahtu bika ila rabbiy fi haajati haadhihi li tuqdaa. Allaahumma shaffi’hu fiyya (O Allaah, I ask of You and I turn my face towards You by the virtue of Muhammad the Prophet of Mercy. O Muhammad, I have turned my face by virtue of you to my Lord concerning this need of mine so that it may be met. O Allaah, accept his intercession concerning me).”

Narrated by al-Tirmidhi, 3578; Ibn Maajah, 1385; this hadeeth was classed as saheeh by al-Tirmidhi and by al-Albaani in Saheeh al-Jaami’, 1279

The Prophet (peace and blessings of Allaah be upon him) commanded him to do wudoo’ and pray two rak’ahs before he made du’aa’; this indicates that prayer is one of the righteous deeds by virtue of which a person’s du’aa’ may be more likely to be answered, and that may be one of the causes of the du’aa’ being answered.

With regard to fasting, what has been said with regard to prayer may also be said with regard to fasting. The intention behind it should be to worship Allaah by means of this great act of worship, and to attain the reward for it in the Hereafter, and to fear Allaah and earn His pleasure. Then if he is fasting, it is mustahabb for the fasting person to make a lot of du’aa’, for the du’aa’ of the fasting person will be answered, especially at the time of breaking the fast.

And Allaah knows best.