Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Peticiones HTTP post sin Curl
<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$url = 'https://jsonplaceholder.typicode.com/posts';
$postData = array([
'title' => 'Hola Mundo',
'body' => 'Este es un ejemplo de envio con POST',
'userId' => 1,
]);
$headers = array([
'Content-type' => 'application/json; charset=UTF-8'
]);
$responsePost = Requests::post($url, null, $postData);
echo json_encode($responsePost);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment