'22222-2', 'nombre'=> 'Prueba ger2', 'estado_civil'=> 'SOLTERO/A', "nacionalidad"=> 'CHILENO', 'telefono'=> '942144199', 'direccion'=> '14 Oriente 14 Sur #075', 'region'=> 'Maule', 'comuna'=> 'Talca', 'ciudad'=> 'Talca', 'tipo_valor'=> 'TOTAL', 'moneda'=> 'PESOS', 'valor'=> 500000, 'estado_contrato'=> 'CONTRATADO', 'activo'=> 1, 'contrato_id'=> 2 ); $payload = json_encode(array('TRABAJADOR' => $data)); //attach encoded JSON string to the POST fields curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); //set the content type to application/json curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json')); //return response instead of outputting curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //execute the POST request $result = curl_exec($ch); //close cURL resource curl_close($ch); ?>