What does this function mean? Function & nbsp; uc_fopen ($ url, & nbsp; $ limit & nbsp ;=& nbsp; 0, & nbsp; $ post & nbsp ;=& nbsp ;'', & nbsp; $ cookie & nbsp ;=& nbsp; '', & nbsp; $ bysocket & nbsp ;=& n what does this function mean?
Function uc_fopen ($ url, $ limit = 0, $ post = '', $ cookie ='', $ bysocket = FALSE, $ ip = '', $ timeout = 15, $ block = TRUE ){
$ Return = '';
$ Matches = parse_url ($ url );
! Isset ($ matches ['host']) & $ matches ['host'] = '';
! Isset ($ matches ['path']) & $ matches ['path'] = '';
! Isset ($ matches ['query']) & $ matches ['query'] = '';
! Isset ($ matches ['port']) & $ matches ['port'] = '';
$ Host = $ matches ['host'];
$ Path = $ matches ['path']? $ Matches ['path']. ($ matches ['query']? '? '. $ Matches ['query']: ''):'/';
$ Port =! Empty ($ matches ['port'])? $ Matches ['port']: 80;
If ($ post ){
$ Out = "POST $ path HTTP/1.0 \ r \ n ";
$ Out. = "Accept: */* \ r \ n ";
// $ Out. = "Referer: $ boardurl \ r \ n ";
$ Out. = "Accept-Language: zh-cn \ r \ n ";
$ Out. = "Content-Type: application/x-www-form-urlencoded \ r \ n ";
$ Out. = "User-Agent: $ _ SERVER [HTTP_USER_AGENT] \ r \ n ";
$ Out. = "Host: $ host \ r \ n ";
$ Out. = 'content-Length: '. strlen ($ post). "\ r \ n ";
$ Out. = "Connection: Close \ r \ n ";
$ Out. = "Cache-Control: no-cache \ r \ n ";
$ Out. = "Cookie: $ cookie \ r \ n ";
$ Out. = $ post;
} Else {
$ Out = "GET $ path HTTP/1.0 \ r \ n ";
$ Out. = "Accept: */* \ r \ n ";
// $ Out. = "Referer: $ boardurl \ r \ n ";
$ Out. = "Accept-Language: zh-cn \ r \ n ";
$ Out. = "User-Agent: $ _ SERVER [HTTP_USER_AGENT] \ r \ n ";
$ Out. = "Host: $ host \ r \ n ";
$ Out. = "Connection: Close \ r \ n ";
$ Out. = "Cookie: $ cookie \ r \ n ";
}
If (function_exists ('fsockopen ')){
$ Fp = @ fsockopen ($ ip? $ Ip: $ host), $ port, $ errno, $ errstr, $ timeout );
} Elseif (function_exists ('pfsockopen ')){
$ Fp = @ pfsockopen ($ ip? $ Ip: $ host), $ port, $ errno, $ errstr, $ timeout );
} Else {
$ Fp = false;
}
If (! $ Fp ){
Return '';
} Else {
Stream_set_blocking ($ fp, $ block); // no program blocking
Stream_set_timeout ($ fp, $ timeout );
@ Fwrite ($ fp, $ out );
$ Status = stream_get_meta_data ($ fp); // Time control for stream reading
If (! $ Status ['timed _ out']) {
While (! Feof ($ fp )){
If ($ header = @ fgets ($ fp) & ($ header = "\ r \ n" | $ header = "\ n ")){