file_get_contents ou curl em php?
Qual defile_get_contents
oucurl
deve ser usado no PHP para fazer uma requisição HTTP?
E sefile_get_contents
vai fazer o trabalho, existe alguma necessidade de usarcurl
? Usandocurl
parece precisar de mais linhas.
por exemplo:
ondulação:
$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);