Function:
Returns the result of a GET or POST  to a url as a string. Useful for posting data from one site to an other.

Requires:
CURL

Source:
function GetPage($sURL, $bIsPost, $sPayload) {
$curl_handle=curl_init();
if (!$bIsPost && $sPayload != “”) {
$sURL=$sURL.”?”.$sPayload; }
curl_setopt($curl_handle,CURLOPT_URL,$sURL);
if ($bIsPost) {
curl_setopt($curl_handle, CURLOPT_POST, 0);
curl_setopt($curl_handle, CURLOPT_POSTFIELDS,$sPayload);
}
curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
$sReturn = curl_exec($curl_handle);
curl_close($curl_handle);
return $sReturn;
}

Example:
$sReturnString=GetPage(’http://www.yahoo.com’, 0, ‘Searchtext=hello world’);