Created
January 11, 2017 06:44
-
-
Save tomedme/75aa5ccdbb7aa3766611402449d8cd7c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$apiKey = 'blah....blah'; | |
$headers = array(); | |
$headers[] = 'Content-Type: text/xml; charset=utf-8'; | |
$headers[] = 'User-Agent: PEAR::XML_RPC2/@package_version@'; // after "User-Agent: " anything is ok, just not empty or missing | |
$params = array($apiKey); | |
// xmlrpc_encode_request() provided by php7.0-xmlrpc | |
$request = xmlrpc_encode_request('version.info', $params, array('encoding' => 'utf-8')); | |
$resource = stream_context_create(array( | |
'http' => array( | |
'method' => 'POST', | |
'header' => $headers, | |
'content' => $request, | |
) | |
)); | |
$response = file_get_contents('https://rpc.ote.gandi.net/xmlrpc/', false, $resource); | |
print_r(xmlrpc_decode($response, 'utf-8')); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment