开发者

Best practices for reading remote files with php

In php when you open a socket connection. you can do it like this:

$fp = @stream_socket_client ( $hosts, $errno, $errstr, 120, STREAM_CLIENT_CONNECT );

or this :

$fp = @fsockopen($Host , $Port, $errno, $errstr, 15);

then you want to get a file

We can do this with a various functions fgets fread stream_get _line etc

What is the best practice for get the better results and higher speed o开发者_开发知识库f transfer?


This is largely subjective to your platform and configuration. Sockets will provide a very efficient transfer, but you'll have to do all the HTTP/FTP request stuff yourself if you want to get a file.

Your best bet is just to try them out yourself and see how it performs.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜