Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php send http request

// Initialize Guzzle client
$client = new GuzzleHttpClient();

// Create a POST request
$response = $client->request(
    'POST',
    'http://example.org/',
    [
        'form_params' => [
            'key1' => 'value1',
            'key2' => 'value2'
        ]
    ]
);

// Parse the response object, e.g. read the headers, body, etc.
$headers = $response->getHeaders();
$body = $response->getBody();

// Output headers and body for debugging purposes
var_dump($headers, $body);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #php #send #http #request
ADD COMMENT
Topic
Name
7+8 =