\n"; } else { if( $method == "GET" ) { fputs( $fp, "GET $usepath HTTP/1.0\n" ); } else if( $method == "POST" ) { fputs( $fp, "POST $usepath HTTP/1.0\n" ); } fputs( $fp, "User-Agent: ".$ua."\n" ); fputs( $fp, "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5\n" ); fputs( $fp, "Host: $host\n"); fputs( $fp, "Connection: Keep-Alive\n"); fputs( $fp, "Authorization: Basic YXdzdGF0czphd3N0YXRzsMDcwMTMwMTA=\n"); if( $method == "POST" ) { $strlength = strlen( $postdata ); fputs( $fp, "Content-type: application/x-www-form-urlencoded\n" ); fputs( $fp, "Content-length: ".$strlength."\n\n" ); fputs( $fp, $postdata."\n\n" ); } fputs( $fp, "\n" ); $output = ""; # while content exists, keep retrieving document in 1K chunks while( !feof( $fp ) ) { $i++; if($i>100) $output .= fgets( $fp, 1024 ); } fclose( $fp ); } return $output; } ?>