file_get_contents или curl в php?
Какой изfile_get_contents
или жеcurl
нужно использовать в PHP, чтобы сделать HTTP-запрос?
Еслиfile_get_contents
будет делать работу, есть ли необходимость в использованииcurl
? С помощьюcurl
Кажется, нужно больше строк.
например:
свернуться:
$ch = curl_init('http://www.website.com/myfile.php');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $content);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec ($ch);
curl_close ($ch);
file_get_contents:
$output = file_get_contents('http://www.website.com/myfile.php'.$content);