Finally, I've found that, which not exactly
what you ask, but is very close to it
<?
function pullpage( $method, $host, $usepath, $postdata ) {
open socket to filehandle
$fp = fsockopen( $host, 80, &$errno, &$errstr, 120 );
# user-agent name
$ua = "UserAgent/1.0";
if( !$fp ) {
print "$errstr ($errno)<br>n";
echo "there";
}
else {
echo "here";
if( $method == "GET" ) {
fputs( $fp, "GET $usepath HTTP/1.1n" );
fputs( $fp, "Host: www.mobilemail.dkn" );
}
else if( $method == "POST" ) {
fputs( $fp, "POST $usepath HTTP/1.1n" );
fputs( $fp, "Host: www.mobilemail.dkn" );
}
fputs( $fp, "User-Agent: ".$ua."n" );
fputs( $fp, "Accept: */*n" );
fputs( $fp, "Accept: image/gifn" );
fputs( $fp, "Accept: image/x-xbitmapn" );
fputs( $fp, "Accept: image/jpegn" );
if( $method == "POST" ) {
$strlength = strlen( $postdata );
fputs( $fp,
"Content-type: application/x-www-form-urlencodedn" );
fputs( $fp, "Content-length: ".$strlength."nn" );
fputs( $fp, $postdata."n" );
}
fputs( $fp, "n" );
$output = "";
# while content exists, keep retrieving document in 1K chunks
while( !feof( $fp ) ) {
$output .= fgets( $fp, 1024 );
}
fclose( $fp );
}
return $output;
}