PHP Simple cURL API call using POST

PHP Simple cURL API call using POST

In this Post We Will Explain About is PHP Simple cURL API call using POST With Example and Demo.Welcome on infinityknow.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to How to make REST calls in PHP Example

In this post we will show you Best way to implement web services – Call a REST API in PHP, hear for php api call json with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

READ :  Vuejs Form input get value - Fetch data in vuejs based on input value

PHP Simple cURL allows some sepecifc data transfer of data across a simple headers wide variety of list of lots of protocols, as well as it is a very easy and powerful and good system. This is simple widely used as a one way to PHP browsers send data across some new websites, and the including things as a php API interaction and secure oAuth.

PHP API call Settings

There are the following list of the PHP web services – Call a REST API in PHP.

  • CURLOPT_RETURNTRANSFER
  • CURLOPT_CONNECTTIMEOUT
  • CURLOPT_TIMEOUT
  • CURLOPT_USERAGENT
  • CURLOPT_URL
  • CURLOPT_POST
  • CURLOPT_POSTFIELDS

how to call api in php using curl POST Request

[php]
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, ‘http://infinityknow.com’);

READ :  PHP cURL API calls POST GET PUT DELETE RESTful CRUD

$curl = curl_init(‘http://infinityknow.com’);
[/php]

cURL Requests with PHP

simple Set some setting options – we are send data passing in a useragent too here

[php]
// live24u Get cURL resource
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => ‘http://infinityknow.com’,
CURLOPT_USERAGENT => ‘live24u Sample cURL Request’,
CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => array(
item1 => ‘admin’,
item2 => ‘admin@12356’
)
));
$resp = curl_exec($curl);
curl_close($curl);
[/php]

You are Most welcome in my youtube Channel Please shubscibe my channel. and give me FeedBackMore Details……
Angularjs Example

Example

I hope you have Got What is web services – Call a REST API in PHP And how it works.I would Like to have FeedBack From My Blog(infinityknow.com) readers.Your Valuable FeedBack,Any Question,or any Comments about This Article(infinityknow.com) Are Most Always Welcome.

READ :  vuejs datatable example - Datatable component using Vuejs-vuejs datatable

Leave a Comment