3/2/2023 0 Comments Php http clientThe $response variable will hold an instance of HttpResponse. >verifySslCertificate(false) // Disables the verification of SSL certificates NOTE: This feature is not recommended in a production system but is meant as a convenience option in test environments $response = HttpRequest::create("") // Base url >timeout(20) // Changes the timeout for the request to 20 seconds >authorization("Bearer", "") // Convenience method to add an Authorization headerĬhanging request timeout $response = HttpRequest::create("") // Base url >basicAuthentication("username", "password") // Adds basic authentication to the requestĪuthorization header $response = HttpRequest::create("") // Base url >cookies() // Adds all cookies from $_COOKIE to the requestīasic Authentication $response = HttpRequest::create("") // Base url >cookies(array("key" => "value")) // Add an array of cookies >cookie("search", "Search query") // Add a single cookie >headers(array("key" => "value")) // Add an array of headersĪdding Cookies $response = HttpRequest::create("") // Base url >header("Accept", "application/json") // Add a single header >parameters(array("key" => "value")) // Add an array of query parametersĪdding Headers $response = HttpRequest::create("") // Base url >parameter("search", "Search query") // Add a single query parameter >delete("delete", array("key" => "value") // Path & bodyĪdding query parameters $response = HttpRequest::create("") // Base url >post("post", array("key" => "value") // Path & bodyĭELETE request $response = HttpRequest::create("") // Base url POST request $response = HttpRequest::create("") // Base url >contentType("application/json") // Content-Type header is a nice service to test HTTP requests against, it provides several ways to try different kinds of requests with a configurable response PUT request $response = HttpRequest::create("") // Base url Request types GET request $response = HttpRequest::create("") // Base url
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |