file_get_contents lub curl w php?
Które zfile_get_contents
lubcurl
powinien być używany w PHP do tworzenia żądania HTTP?
Jeślifile_get_contents
wykona pracę, czy jest jakaś potrzebacurl
? Za pomocącurl
wydaje się potrzebować więcej linii.
na przykład:
kędzior:
$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);