Allow

xiaoxiao2021-03-06  75

Allow_URL_FOPEN = ON often causes trouble to the server, but often (at least I think), we need to read something remotely if you set it_url_fopen = OFF, we have no way to read.

Fortunately, we have a good PHP module - CURL. Below I will talk about the way I use CURL remotely with a CURL:

First, allow_url_fopen = ON case:

$ Str = file_get_contents ("http://www.9cbs.net/");

IF ($ STR! == false) {

// Do Something with The Content

Echo $ STR;

}

?>

Second, the case of allow_url_fopen = OFF:

$ CH = curl_init ("http://www.9cbs.net/");

CURL_SETOPT ($ Ch, CURLOPT_FOLLOCATION, 1);

CURL_SETOPT ($ CH, CURLOPT_RETURNTRANSFER, 1);

$ Str = curl_exec ($ ch);

IF ($ STR! == false) {

// Do Something with The Content

Echo $ STR;

}

CURL_CLOSE ($ CH);

?>

Remarks: About Allow_URL_FOPEN = ON, please see how to attack common vulnerabilities in the PHP program (below)

转载请注明原文地址:https://www.9cbs.com/read-121526.html

New Post(0)