here is it what i want:- 1) Send a request to website using php. (like www.xyz.com?id=2) 2) Capture the response ans store it in a string
best way to do it is with curl. curl[dot]haxx[dot]se (sorry can't post links yet) is probably the best resource with loads of examples
Did you google for this? If you have lib curl installed you can use curl which is allowed in shard host. If you have vps or dedicated server you should use url wrapper provided by PHP. Its built in PHP so its quite easy. But curl is your best bet. Its enabled in almost 99% of LAMP server. you can google "PHP Curl example" and you'll fine numerous examples. I use this PHP class. WebGet. It supports file system caching and provides the response in a good structure so you can parse it easily later. See this example how craiglist is being parsed.
file_get_contents(url) is good enough if you have allow_url_fopen is enabled in your php hosting otherwise use curl.
I like the cURL approach, since it's possible to modify a lot of settings that are sometimes required, and not possible to do with a simple file_get_contents. Something like this should get you started: $url = "http://xyz.com"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); // curl_setopt($ch, CURLOPT_HEADER, true); // Enable this if you want the HTTP Headers returned curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); Code (markup): Using cURL you could, for example, modify the HTTP Headers you're sending, create SSL connections that're properly verified, use cookies and other things. You can also use it to log into other websites and pull data.