Reputation: 29
Iam using MX API and want to convert curl command to php. The command is as follows:
curl -i -X GET 'https://vestibule.mx.com/institutions' \
-H 'Accept: application/vnd.mx.atrium.v1+json' \
-H 'MX-API-Key: de9f1ed2-6332-ff80-0493-11ea9952cfb3' \
-H 'MX-Client-ID: c3d38602-3a95-401f-9116-8fcedfa87dfd'
Any help would be highly appreciated
Upvotes: 0
Views: 90
Reputation:
Paste your curl command into curlconverter.com/php/ and it will convert it into this PHP code using PHP's cURL integration:
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://vestibule.mx.com/institutions');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Accept' => 'application/vnd.mx.atrium.v1+json',
'MX-API-Key' => 'de9f1ed2-6332-ff80-0493-11ea9952cfb3',
'MX-Client-ID' => 'c3d38602-3a95-401f-9116-8fcedfa87dfd',
]);
$response = curl_exec($ch);
curl_close($ch);
Upvotes: 0
Reputation: 866
Google is your friend: There is a PHP-plugin which offers an API to use curl: https://secure.php.net/manual/de/book.curl.php
And you can use a class by pyromus and extend it to your needs: https://secure.php.net/manual/de/book.curl.php#86391
Upvotes: 1