Message: Return type of CI_Session_files_driver::open($save_path, $name) should either be compatible with SessionHandlerInterface::open(string $path, string $name): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
Message: Return type of CI_Session_files_driver::close() should either be compatible with SessionHandlerInterface::close(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
Message: Return type of CI_Session_files_driver::read($session_id) should either be compatible with SessionHandlerInterface::read(string $id): string|false, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
Message: Return type of CI_Session_files_driver::write($session_id, $session_data) should either be compatible with SessionHandlerInterface::write(string $id, string $data): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
Message: Return type of CI_Session_files_driver::destroy($session_id) should either be compatible with SessionHandlerInterface::destroy(string $id): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
Message: Return type of CI_Session_files_driver::gc($maxlifetime) should either be compatible with SessionHandlerInterface::gc(int $max_lifetime): int|false, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
cURL jest biblioteką która umożliwia tworzenie zapytań HTTP bardzo często wykorzystywana jest podczas komunikacji pomiędzy różnymi aplikacjami wykorzystującymi technologi webowe np. podczas korzystania z API serwisów internetowych.
Żądania możemy oczywiście wysyłać zarówno metodą POST jaki GET (oraz tworzyć dodatkowe np. PUT jednak nie jest to przedmiotem tego artykułu). Skupimy się wiec na początek na podstawowej metodzie i wykonamy przykład z GET.
Metoda GET
Pierwsza linia to oczywiście curl_init czyli inicjowanie nowej sesji. Funkcja zwraca uchwyt cURL handle który zapisujemy w zmiennej $request.
$request = curl_init();
Następnie polecenia to szereg wywołań funkcji curl_setopt która ustawia opcję cURL. Definiujemy trzy parametry dla tej funkcji
pierwszy to oczywiści cURL handle, drugi to opcja a trzeci jej wartość.
Zaczynamy od CURLOPT_HEADER ustawiamy FALSE aby pominąć nagłówek
curl_setopt($request, CURLOPT_HEADER, FALSE);
Następnie CURLOPT_RETURNTRANSFER ustawiamy na TRUE aby otrzymac w odpowiedzi string