Jump to content
php.lv forumi

Faila nolasīšana no cita servera


KillerBean

Recommended Posts

Sveiki. Varbūt kāds var izskaidrot, kāpēc

$url = "http://www.weblapa.lv";
$cont = file_get_contents($url);
echo $url." saturs: ".$cont;

Kods izpildās viss ok tik ilgi, kamēr dati fiziski atrodas uz viena un tā paša servera? Ja meklē kādā citā serverī kods nokarās Timeout'ā. Vaina firewallos jāmeklē? vai kaut kur citur?

Link to comment
Share on other sites

Nu, http jau pats par sevi nozīmē 80 ports, ja nav norādīts citādi.

Palasot par file_get_contents() ir minēts, ka lai varētu attālinātos failus vērt vaļā ir:

allow_url_fopen boolean

 

This option enables the URL-aware fopen wrappers that enable accessing URL object like files. Default wrappers are provided for the access of remote files using the ftp or http protocol, some extensions like zlib may register additional wrappers.

 

Note: This setting can only be set in php.ini due to security reasons.

 

Note: This option was introduced immediately after the release of version 4.0.3. For versions up to and including 4.0.3 you can only disable this feature at compile time by using the configuration switch --disable-url-fopen-wrapper .

 

Warning

 

On Windows versions prior to PHP 4.3.0, the following functions do not support remote file accessing: include(), include_once(), require(), require_once() and the imagecreatefromXXX functions in the GD Functions extension

 

Pārbaudi, vai ar šiem uzstādījumiem viss ir kārtībā.

Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...