Search
 
SCRIPT & CODE EXAMPLE
 

PHP

curl post json

curl -X POST -H "Content-Type: application/json" 
 -d '{"username":"abc","password":"abc"}' 
 https://api.example.com/v2/login
Comment

php curl post json

$ch = curl_init( $url );
# Setup request to send json via POST.
$payload = json_encode( array( "customer"=> $data ) );
curl_setopt( $ch, CURLOPT_POSTFIELDS, $payload );
curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
# Return response instead of printing.
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
# Send request.
$result = curl_exec($ch);
curl_close($ch);
Comment

curl post request

curl -d "user=user1&pass=abcd" -X POST https://example.com/login
Comment

curl post json object command

curl -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"id":100}' http://localhost/api/postJsonReader.do
Comment

curl post

# dont forget the content type, else it will throw an error

curl -X POST -H "Content-Type: application/json" 
 -d '{"username":"abc","password":"abc"}' 
 https://api.example.com/v2/login
Comment

php curl post json

function curl( string $url, array $data)
{
	function send($url, $request)
	{
		$ch = curl_init();
		$headers = [
			'Accept: application/json',
			'Content-Type: application/json',
		];
		$options = [
			CURLOPT_URL => $url,
			CURLOPT_POST => true,
			CURLOPT_POSTFIELDS => $request,
			CURLOPT_FOLLOWLOCATION => true,
			CURLOPT_RETURNTRANSFER => true,
			CURLOPT_HEADER => true,
			CURLOPT_HTTPHEADER => $headers,
		];

		curl_setopt_array($ch, $options);
		$response = curl_exec($ch);
		curl_close($ch);
		
		return $response;
	}

	return send($url, json_encode($data));
}
Comment

curl post

curl -X POST -d "param1=value1&param2=value2" https://example.com/post
Comment

curl post

curl --data '' https://example.com/resource.cgi

curl -X POST https://example.com/resource.cgi

curl --request POST https://example.com/resource.cgi
Comment

curl json post

<?php

$url = "https://reqbin.com/echo/post/json";

$curl = curl_init($url);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

$headers = array(
   "Content-Type: application/json",
);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);

$data = '{"login":"my_login","password":"my_password"}';

curl_setopt($curl, CURLOPT_POSTFIELDS, $data);

//for debug only!
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);

$resp = curl_exec($curl);
curl_close($curl);
var_dump($resp);

?>
Comment

curl post

curl -d "@data.txt" -X POST http://localhost:3000/data
Comment

curl post

curl -H "Content-Type: application/json" -d "@data.json" -X POST http://localhost:3000/data
Comment

curl post request

curl -d "user=user1&pass=abcd" https://example.com/login
Comment

curl POST

curl-X POST http://localhost:8080/api/guests -H 'Content-Type: application/json' -d '{"lastName":"Zithi", "firstName":"Ans"}'
-H header content
-d json payload/data
Comment

send json by curl

root@mcsOS:~# curl -X PATCH -d '{"user-block-request":"true"}' 127.0.0.1:8082/v1/ticket-validators -i
Comment

PREVIOUS NEXT
Code Example
Php :: php explode end 
Php :: how to call php function from ajax 
Php :: Laravel - Query Builder Left join 
Php :: como destruir uma variavel de sessão 
Php :: return with success message laravel 
Php :: country code validation in laravel 
Php :: php get 
Php :: laravel get data in pivot table 
Php :: .htaccess Prevent access to php.ini 
Php :: get value mentthod get laravel 
Php :: substract two datetime and get the different hours and minutes php 
Php :: how to make core controller codeigniter 3 more than 1 
Php :: luhn algorithm 
Php :: wordpress enqueue js 
Php :: laravel outer join 
Php :: Codeigniter 3 Get future date recocords - upcoming records from database 
Php :: how to create 404 page in php website 
Php :: autoloader php 
Php :: Advanced Custom Fields get sub field image 
Php :: $_get and $_post in php 
Php :: aws sdk php 
Php :: livewire call another component 
Php :: twig log variable 
Php :: laravel select where with total sum query to get all data with sum 
Php :: call to a member function get_results() on null 
Php :: mysql escape apostrophe 
Php :: php array serialize 
Php :: jquery is less than or equal to 
Php :: laravel copy row 
Php :: Method IlluminateDatabaseEloquentCollection::delete does not exist. 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =