开发者

any one know better then curl function in php i need help

anybody know the replacement of curl开发者_开发百科 function in php

$ch = curl_init($connect_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$curl_scraped_page = curl_exec($ch);
curl_close($ch);
return $curl_scraped_page;


You can use socket connection functions available in php.

http://php.net/manual/en/book.sockets.php


If allow_url_fopen = 1 (in your php.ini):

$content = file_get_contents('http://example.com/index.html');

or

$handle = fopen("http://www.example.com/", "r");


What's the problem you are trying to solve? Curl unavailable? Is safe mode enabled? Something else? Have you tried using the http stream wrappers? e.g.

return file_get_contents($connect_url);
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜