curlopt_postfields php example
<?php
$postRequest = array(
'firstFieldData' => 'foo',
'secondFieldData' => 'bar'
);
$cURLConnection = curl_init('http://hostname.tld/api');
curl_setopt($cURLConnection, CURLOPT_POSTFIELDS, $postRequest);
curl_setopt($cURLConnection, CURLOPT_RETURNTRANSFER, true);
$apiResponse = curl_exec($cURLConnection);
curl_close($cURLConnection);
// $apiResponse - available data from the API request
$jsonArrayResponse - json_decode($apiResponse);<?php
$cURLConnection = curl_init();
curl_setopt($cURLConnection, CURLOPT_URL, 'https://hostname.tld/phone-list');
curl_setopt($cURLConnection, CURLOPT_RETURNTRANSFER, true);
$phoneList = curl_exec($cURLConnection);
curl_close($cURLConnection);
$jsonArrayResponse - json_decode($phoneList);
Also in PHP:
- console data in php
- auto refresh page in php
- command to clear all cache in laravel
- .length php
- check key in array php
- check if part of the string is in other string with space or special caracter php
- console log a variable in php
- count text length php
- datetime-local laravel migration data type
- catch multiple exceptions php
- error init php eroirrs
- afiseaza id-ul sesiunii php
- codeigniter update
- divide page in pdf with page break using php
- @foreach output reverse
- check string php
- Create image data URIs (base64) using PHP Raw
- array contains key php
- check website ssl certificate using php openssl_x509_parse
- check variable data type with value in php
- What parameter should you enable if you wish for your browser to show all errors?
- autoload file in laravel
- create 5 rendom charactors in php
- check if a string has specific word and ignore it