Hot to send a nested json post request with cURL and PHP - php

I must send a post request with the following json data structure using PHP and cURL:
{
"assistanceRequest":
{
"type": "TECHNICAL_DATA",
"deliveryMode": "NORMAL",
"creationDate": "2020-04-09T10:09:00+02:00",
"source": "ATD",
"language": "FR",
"country": "FR"
},
"customer":
{
"code": 123456,
"login": "client#company.com",
"companyName": "Workshop Harris",
"phoneNumber": "+44 123456789",
"email": "workshop#company.com"
},
}
However I don't understand how to create a similar request. I tried with the following code but I suppose it's not correct because I should group the data in two blocks:
$post = [
'type' => 'TECHNICAL_DATA',
'deliveryMode' => 'NORMAL',
'creationDate' => '2020-04-16T12:46:33+02:00',
'source' => 'ATD',
'language' => 'FR',
'country' => 'CH',
'code' => '123456',
'login' => 'FR1234561A',
'companyName' => 'Workshop Harris Love',
'phoneNumber' => '+390432561543',
'email' => 'client#client.com', ];
$post_encoded = json_encode($post);
$ch = curl_init('http://222.333.333.444/opafffws/public/api/req');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_encoded);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($post_encoded))
);
$response = curl_exec($ch);
echo "The response 1: <br>" . $response;
echo "<br>";
curl_close($ch);
Can help?

<?php
$data = [
'assistanceRequest' => [
'type' => 'TECHNICAL_DATA',
'deliveryMode' => 'NORMAL',
"creationDate" => "2020-04-09T10:09:00+02:00",
"source" => "ATD",
"language" => "FR",
"country" => "FR"
],
'customer' => [
"code" => 123456,
"login" => "client#company.com",
"companyName" => "Workshop Harris",
"phoneNumber" => "+44 123456789",
"email" => "workshop#company.com"
],
];
echo "<pre>"; print_r(json_encode($data));
This is an example for your structure. Tweak it as you need.
The output of the above code will be:
{
"assistanceRequest": {
"type": "TECHNICAL_DATA",
"deliveryMode": "NORMAL",
"creationDate": "2020-04-09T10:09:00+02:00",
"source": "ATD",
"language": "FR",
"country": "FR"
},
"customer": {
"code": 123456,
"login": "client#company.com",
"companyName": "Workshop Harris",
"phoneNumber": "+44 123456789",
"email": "workshop#company.com"
}
}

Related

PHP Array and Updating an Array with data from another nested array [duplicate]

This question already has answers here:
How to extract and access data from JSON with PHP?
(1 answer)
How can I replace a specific key's value in an array in php?
(2 answers)
Closed 7 months ago.
I all, I've been staring at this for hours so any help is greatly appreciated. I have an array...
$aircraft = [
'N7826C' => ['nnum' => 'N7826C', 'name' => 'ANAHEIM POLICE DEPT', 'icon' => 'police', 'lat' => '', 'lng' => '', 'status' => '0'],
'N226PD' => ['nnum' => 'N226PD', 'name' => 'ANAHEIM POLICE DEPT', 'icon' => 'police', 'lat' => '', 'lng' => '', 'status' => '0'],
'N326PD' => ['nnum' => 'N326PD', 'name' => 'CITY OF ANAHEIM', 'icon' => 'police', 'lat' => '', 'lng' => '', 'status' => '0'],
'N826PD' => ['nnum' => 'N826PD', 'name' => 'CITY OF ANAHEIM', 'icon' => 'police', 'lat' => '', 'lng' => '', 'status' => '0']
];
With that array, I implode it to get a list of the nnums to pass through a API....
$aircraftNNUMlist = implode(',', array_map(function($v) { return $v['nnum']; }, $aircraft));
$json = file_get_contents('https://airlabs.co/api/v9/flights?_fields=reg_number,lat,lng&reg_number='.$aircraftNNUMlist.'&api_key=XXXXX');
That API returns...
{
"request": {
"lang": "en",
"currency": "USD",
"time": 15,
"id": "c9by9lmq1q0",
"server": "z",
"host": "airlabs.co",
"pid": 322387,
"key": {
"id": 19146,
"api_key": "xxxxxxxxxxxxxxxx",
"type": "free",
"expired": "2022-08-20T22:00:00.000Z",
"registered": "2022-07-19T03:51:04.000Z",
"limits_by_hour": 2500,
"limits_by_minute": 250,
"limits_by_month": 1000,
"limits_total": 628
},
"params": {
"_fields": "reg_number,lat,lng",
"reg_number": "N60NT,N40NT,N30NT,N10NT",
"lang": "en"
},
"version": 9,
"method": "flights",
"client": {
"ip": "xxxxxxxxxxxxxxxxx",
"geo": {
"country_code": "US",
"country": "United States",
"continent": "North America",
"city": "Provo",
"lat": 40.2181,
"lng": -111.6133,
"timezone": "America/Denver"
},
"connection": {
"type": "corporate",
"isp_code": 46606,
"isp_name": "Unified Layer"
},
"device": {},
"agent": {},
"karma": {
"is_blocked": false,
"is_crawler": false,
"is_bot": false,
"is_friend": false,
"is_regular": true
}
}
},
"response": [
{
"reg_number": "N60NT",
"lat": 34.11,
"lng": -117.69
}
],
"terms": "Unauthorized access is prohibited and punishable by law. \nReselling data 'As Is' without AirLabs.Co permission is strictly prohibited. \nFull terms on https://airlabs.co/. \nContact us info#airlabs.co"
}
I am having trouble looping through the "response" of the API return (stored at $json) to update the corresponding index in $aircraft. If a nnum isn't currently active there will not be a entry in "response" for instance "response" only has N60NT in the return array. I am fairly new to arrays so I've been taking swings in the dark and nothing seems to be right.
I presume you have json_decoded your api json response into a PHP array. Well actually:
$arr = json_decode($json_form_api, true);
$response = $arr["response"];
foreach ($response as $sub) {
$reg = $sub["reg_number"];
$aircraft[$reg]["lat"] = $sub["lat"];
$aircraft[$reg]["lng"] = $sub["lng"];
}

DocuSign error: ANCHOR_TAG_PROCESSING_FAILURE

I am creating and sending an envelope (in PHP) via the DocuSign API.
Here is the PHP code:
$headers = array(
'Authorization: Bearer '. $infos["access_token"],
'Content-Type:application/json'
);
$file = base64_encode("document.pdf");
$postfields = [
"documents" => [
[
"documentBase64" => $file,
"documentId" => "1",
"name" => "Document",
"fileExtension" => "pdf"
]
],
"emailSubject" => "Please sign this document set",
"recipients" => [
"carbonCopies" => [
[
"email" => "[EMAIL_CC]",
"name" => "CC",
"recipientId" => "2",
"routingOrder" => "2"
]
],
"signers" => [
[
"email" => "[EMAIL]",
"name" => "Hey",
"recipientId" => "1",
"recipientIdGuid" => "1",
"routingOrder" => "1",
"tabs" => [
"signHereTabs" => [
[
"anchorString" => "« Lu et approuvé »",
"name" => "« Lu et approuvé »",
"anchorUnits" => "pixels",
"anchorXOffset" => "20",
"anchorYOffset" => "35"
]
]
]
]
]
],
"status" => "sent"
];
$curl = curl_init("https://demo.docusign.net/restapi/v2.1/accounts/".$GLOBALS['account_id']."/envelopes");
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($postfields));
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
// Exécution de la requête
$infos2 = curl_exec($curl);
if($infos2 === false) {
return curl_error($curl);
} else {
$infos2 = json_decode($infos2, true);
curl_close($curl);
return var_dump($infos2);
}
When I run my script, I get the error message:
array (size=2)
'errorCode' => string 'ANCHOR_TAG_PROCESSING_FAILURE' (length=29)
'message' => string 'An Error Occurred during anchor tag processing. Invalid document' (length=64)
However, when I use the Docusign Explorer API, everything works fine.
Here is the recovered JSON code :
{
"documents": [
{
"documentBase64": "JVBERi0xLjQKJeLjz9MKMyAwIG9iago8PC9UeXBlIC9QYWdlCi9QYXJlbnQgMSAwIFIKL01lZGlhQm94IFswIDAgNTk1LjI4MCA4NDEuODkwXQovVHJpbUJveCBbMC4wMDAgMC4wMDAgNTk1LjI4MCA4NDEuODkwXQovUmVzb3VyY2VzIDIgMCBSCi9Hcm91cCA8PCAvVHlwZSAvR3JvdXAgL1MgL1RyYW5zcGFyZW5jeSAvQ1MgL0RldmljZVJHQiA+PiAKL0NvbnRlbnRzIDQgMCBSPj4KZW5kb2JqCjQgMCBvYmoKPDwvRmlsdGVyIC9GbGF0ZURlY29kZSAvTGVuZ3RoIDIyNjE+PgpzdHJlYW0KeJztWsty20YW7Wz5B7Pr8sZW1RghGm/tZEfR2CUrtkUnqYqzoEiKZooPGyTl8V9NzRdlN2E2+YBs5tzbDzZAkIIsL1I1YxVAonH7vvu+aPmhEwZd/JPdykd1MewGeVGEcjDrPOnJr78NZU4vZO9anvY0AjnuMLA863x9dhnK8RLPSZrJjx3AlZ2ffpZdOXTvGE1SQfNBU6vcy7GUtF0CPosClSkZZkGYRLI3lPKRuBQTMR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+48i8L9YUTEBz1SOguWLS44uLvk3TDm73xi3OeS4sMCFYyTzOHfkKwh5Ok0GAtjDh0jXnOaQ8pNZWKH4fvSs+1PPOCApiCM+ONjr...",
"documentId": "1",
"fileExtension": "pdf",
"name": "Document"
}
],
"emailSubject": "Please sign this document set",
"recipients": {
"carbonCopies": [
{
"email": "[EMAIL_CC]",
"name": "CC",
"recipientId": "2",
"routingOrder": "2"
}
],
"signers": [
{
"email": "[EMAIL]",
"name": "Hey",
"recipientId": "1",
"recipientIdGuid": "1",
"routingOrder": "1",
"tabs": {
"signHereTabs": [
{
"anchorString": "« Lu et approuvé »",
"name": "« Lu et approuvé »",
"anchorUnits": "pixels",
"anchorXOffset": "20",
"anchorYOffset": "35"
}
]
}
}
]
},
"status": "sent"
}
I have the impression that the problem comes from the "base64" encoding of the file.
Do you have any idea how to solve my problem ?
Thank you in advance.
For your information, I finally found the solution to my problem!
I did this :
$file = base64_encode(file_get_contents("Chemin/document.pdf"));
instead of :
$file = base64_encode("document.pdf");
Thank you in advance.

How to access a json child in php respect validation?

I'm trying to validate the following json file but I can't find the way to access the "Address" child, how should I do it? Everything goes fine until it tries to access the "address" field.
Json:
{
"first_name": "Test",
"last_name": "Test",
"email": "test#gmail.com",
"mobile_phone": 123456789,
"address": {
"country": "Test",
"postal_code": "Test",
"city": "Test",
"street": "Test",
"number": "Test",
"floor": "Test",
"door": "Test"
},
"password": "Test",
"birth_date": "2005-12-30"
}
Code:
$data = $this->validator->validate($request, [
"first_name" => v::stringVal()->notEmpty(),
"last_name" => v::stringVal()->notEmpty(),
"email" => v::notEmpty()->email(),
"mobile_phone" => v::intVal()->notEmpty(),
"address" =>[
"country" => v::stringVal()->notEmpty(),
"postal_code" => v::stringVal()->notEmpty(),
"city" => v::stringVal()->notEmpty(),
"street" => v::stringVal()->notEmpty(),
"number" => v::stringVal()->notEmpty(),
"floor" => v::stringVal()->notEmpty(),
"door" => v::stringVal()->notEmpty(),
],
"password" => v::base64()->notEmpty(),
"birth_date" => v::date()->notEmpty()
]);
Looks like you are using Respect\Validation\Validator. We can make use of chained validation and the Key function to validate sub-arrays as shown in the docs.
$data = [
'parentKey' => [
'field1' => 'value1',
'field2' => 'value2'
'field3' => true,
]
];
Using the next combination of rules, we can validate child keys.
v::key(
'parentKey',
v::key('field1', v::stringType())
->key('field2', v::stringType())
->key('field3', v::boolType())
)
->assert($data); // You can also use check() or validate()
Applied to your data, the validation could look like this:
use Respect\Validation\Validator as v;
$json = json_decode('{
"first_name": "Test",
"last_name": "Test",
"email": "test#gmail.com",
"mobile_phone": 123456789,
"address": {
"country": "Test",
"postal_code": "Test",
"city": "Test",
"street": "Test",
"number": "Test",
"floor": "Test",
"door": "Test"
},
"password": "Test",
"birth_date": "2005-12-30"
}', true);
v::create()
->key('first_name', v::stringType()->length(1, 32))
->key('last_name', v::stringVal()->notEmpty())
//->..
->key('address',
v::key('country', v::stringType()->length(1, 32))
->key('postal_code', v::stringType()->length(1, 32))
->key('city', v::stringType()->length(1, 32))
//->..
)
->key('password', v::stringVal()->notEmpty())
->key('birth_date', v::stringVal()->notEmpty())
->assert($json); // You can also use check() or validate()
That is the way to access the child of the json:
$this->validator->validate($request, [
"first_name" => v::stringVal()->notEmpty(),
"last_name" => v::stringVal()->notEmpty(),
"email" => v::notEmpty()->email(),
"mobile_phone" => v::intVal()->notEmpty(),
"address" => v::notEmpty()
->key("country", v::stringVal()->notEmpty())->key("postal_code", v::stringVal())->key("city", v::stringVal()->notEmpty())->key("street", v::stringVal()->notEmpty())->key("number", v::stringVal())->key("floor", v::stringVal())->key("door", v::stringVal()),
"password" => v::base64()->notEmpty(),
"birth_date" => v::date('d/m/Y')->notEmpty()
]);

JSON and CURL problems

world! I'm having some troubles with my API script with OLX. Can someone help me, please?
I'm making a JSON that returns this:
{
"access_token": "7b1cb35b4eca28be89174d75baf66e00d2728bf6",
"ad_list": [
{
"id": "31dasa1d23",
"operation": "insert",
"category": 1040,
"subject": "Título teste - Anúncio OLX - Marília/SP",
"body": "Imóvel com Sala, Copa, Cozinha planejada e Gabinete, 3 Dormitórios sendo 1 suíte, Lavanderia com Área de Serviço Coberta, Espaço Gourmet com Churrasqueira e Chuveirão para Ducha, Garagem para 2 Carros, Cerca Elétrica e Interfone. Confira mais sobre o imóvel: http://www.silvioimoveis.com.br/imovel-residencial-professor-antonio-da-silva-penteado-marilia-sp-venda/principal/imovel/principal/5394",
"phone": 1433333333,
"type": "s",
"price": 260000,
"zipcode": "17504000",
"params":{
"rooms": "3",
"garage_spaces": "2"
},
"images": [
"http://homologacao.silvioimoveis.com.br/fotos/imoveis_internos/5394/2175ea284f81f03.jpg",
"http://homologacao.silvioimoveis.com.br/fotos/imoveis_internos/5394/bb0ff30ac2bcbae.jpg"
]
}
]
}
And my code to create this JSON is:
$json = '{
"access_token": "'.$data['access_token'].'",
"ad_list": [
{
"id": "'.$jsonGerado[0]['id'].'",
"operation": "'.$jsonGerado[0]['operation'].'",
"category": '.$jsonGerado[0]['category'].',
"subject": "'.$jsonGerado[0]['subject'].'",
"body": "'.$jsonGerado[0]['body'].'",
"phone": '.$jsonGerado[0]['phone'].',
"type": "'.$jsonGerado[0]['type'].'",
"price": '.$jsonGerado[0]['price'].',
"zipcode": "'.$jsonGerado[0]['zipcode'].'",
"params": {
"rooms": "'.$jsonGerado[0]['params']['rooms'].'",
"garage_spaces": "'.$jsonGerado[0]['params']['garage_spaces'].'"
},
"images": [
'.$jsonGerado[0]['images']['linkFotoPrincipal'].',
'.$jsonGerado[0]['images']['linkDemaisFotos'][0].',
'.$jsonGerado[0]['images']['linkDemaisFotos'][1].',
'.$jsonGerado[0]['images']['linkDemaisFotos'][2].',
'.$jsonGerado[0]['images']['linkDemaisFotos'][3].',
'.$jsonGerado[0]['images']['linkDemaisFotos'][4].',
'.$jsonGerado[0]['images']['linkDemaisFotos'][5].',
'.$jsonGerado[0]['images']['linkDemaisFotos'][6].',
'.$jsonGerado[0]['images']['linkDemaisFotos'][7].',
'.$jsonGerado[0]['images']['linkDemaisFotos'][8].',
'.$jsonGerado[0]['images']['linkDemaisFotos'][9].'
]
}
]
}';
The CURL code is:
curl_setopt_array($curl, array(
CURLOPT_URL => "https://apps.olx.com.br/autoupload/import",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => $json
));
And finally, the error is:
When I don't use json_encode() in $json variable, I got "NULL value found..." instead of "string value found"
As RiggsFolly mentioned, use json_encode on a PHP array or object rather than building the JSON yourself. Here's an example of how you might do that with the example code you provided:
$json_array = array(
"access_token" => $data['access_token'],
"ad_list" => array(
array(
"id" => $jsonGerado[0]['id'],
"operation" => $jsonGerado[0]['operation'],
"category" => $jsonGerado[0]['category'],
"subject" => $jsonGerado[0]['subject'],
"body" => $jsonGerado[0]['body'],
"phone" => $jsonGerado[0]['phone'],
"type" => $jsonGerado[0]['type'],
"price" => $jsonGerado[0]['price'],
"zipcode" => $jsonGerado[0]['zipcode'],
"params" => array(
"rooms" => $jsonGerado[0]['params']['rooms'],
"garage_spaces" => $jsonGerado[0]['params']['garage_spaces']
),
"images" => array(
$jsonGerado[0]['images']['linkFotoPrincipal'],
$jsonGerado[0]['images']['linkDemaisFotos'][0],
$jsonGerado[0]['images']['linkDemaisFotos'][1],
$jsonGerado[0]['images']['linkDemaisFotos'][2],
$jsonGerado[0]['images']['linkDemaisFotos'][3],
$jsonGerado[0]['images']['linkDemaisFotos'][4],
$jsonGerado[0]['images']['linkDemaisFotos'][5],
$jsonGerado[0]['images']['linkDemaisFotos'][6],
$jsonGerado[0]['images']['linkDemaisFotos'][7],
$jsonGerado[0]['images']['linkDemaisFotos'][8],
$jsonGerado[0]['images']['linkDemaisFotos'][9]
)
)
)
);
You can then do $json = json_encode($json_array);. I hope that helps!

combine array in php json encode

I develop php code like this :
while($row = mysql_fetch_array ($result))
{
$catalogue = array(
'catalogue_id' => $row[0],
'catalogue_name' => $row[1],
'catalogue_cover' => $row[2],
'category' => array(
'id' => $row[3],
'name' => $row[4],
'cover' => $row[5],
'item' => array (
'id' => $row[6],
'name' => $row[7],
'cover' => $row[8],
'description' => $row[9],
'price' =>$row[10]
)
),
);
array_push($json, $catalogue);
}
$jsonresult = array2json($json);
echo $jsonresult;
The result json is :
[
{
"catalogue_id": "59",
"catalogue_name": "IT Catalog",
"catalogue_cover": "http://192.168.0.22:90/Ecatalogue/catalogue/covers/511b21f398969.jpeg",
"category": {
"id": "60",
"name": "Computer Accessory",
"cover": "http://192.168.0.22:90/Ecatalogue/category/covers/511b2e11e8b26.jpg",
"item": {
"id": "61",
"name": "CD",
"cover": "http://192.168.0.22:90/Ecatalogue/item/covers/511b2e1da3063.jpg",
"description": "",
"price": "0.00"
}
}
},
{
"catalogue_id": "59",
"catalogue_name": "IT Catalog",
"catalogue_cover": "http://192.168.0.22:90/Ecatalogue/catalogue/covers/511b21f398969.jpeg",
"category": {
"id": "61",
"name": "IT Category",
"cover": "http://192.168.0.22:90/Ecatalogue/category/covers/511caf7329f63.jpeg",
"item": {
"id": "63",
"name": "IT Item",
"cover": "http://192.168.0.22:90/Ecatalogue/item/covers/511cafa17cce5.jpeg",
"description": "",
"price": "0.00"
}
}
}
]
But I want to combine the same catalog like this :
[
{
"catalogue_id": "59",
"catalogue_name": "IT Catalog",
"catalogue_cover": "http://192.168.0.22:90/Ecatalogue/catalogue/covers/511b21f398969.jpeg",
"category": {
"id": "60",
"name": "Computer Accessory",
"cover": "http://192.168.0.22:90/Ecatalogue/category/covers/511b2e11e8b26.jpg",
"item": {
"id": "61",
"name": "CD",
"cover": "http://192.168.0.22:90/Ecatalogue/item/covers/511b2e1da3063.jpg",
"description": "",
"price": "0.00"
},
"category-2": {
"id": "61",
"name": "IT Category",
"cover": "http://192.168.0.22:90/Ecatalogue/category/covers/511caf7329f63.jpeg",
"item": {
"id": "63",
"name": "IT Item",
"cover": "http://192.168.0.22:90/Ecatalogue/item/covers/511cafa17cce5.jpeg",
"description": "",
"price": "0.00"
}
}
}
}
]
How can I do that ?
You can index the $catalogue by catalogue_id and append category as they come
while ($row = mysql_fetch_array($result)) {
$catalogue_id = $row[0];
if (!isset($json[$catalogue_id])) {
$json[$catalogue_id] = array(
'catalogue_id' => $catalogue_id,
'catalogue_name' => $row[1],
'catalogue_cover' => $row[2]
'categories' => array();
);
}
$json[$catalogue_id]['categories'][] = array(
'id' => $row[3],
'name' => $row[4],
'cover' => $row[5],
'item' => array (
'id' => $row[6],
'name' => $row[7],
'cover' => $row[8],
'description' => $row[9],
'price' =>$row[10]
);
}
$jsonresult = array2json(array_values($json));
echo $jsonresult;
Instead of array2json you could also use json_encode
echo json_encode(array_values($json));

Categories