0

I'm trying the REST API of Click2Mail.

I cannot get to work a simple API call using GET method using php CURL

This is the link of XML https://marlzdummy@gmail.com:Tambiga1!@stage-rest.click2mail.com/molpro/documents

I need to get the XML content via CURL but I'm not getting any result

My php code snippet is below:

<?php
$ch = curl_init('https://marlzdummy@gmail.com:Tambiga1!@stage-rest.click2mail.com/molpro/documents');                                                                
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");                                                                                                                                    
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);                                                                      
curl_setopt($ch, CURLOPT_HTTPHEADER, array(                                                                          
    'Content-Type: application/xml')                                                                       
);                                                                                                                   

$res = curl_exec($ch);                                    

$xml = simplexml_load_string($res);

echo $xml;

?>

If I do below, I get a result, but I need to use CURL for POST and GET.

$xml = simplexml_load_file('https://marlzdummy@gmail.com:Tambiga1!@stage-rest.click2mail.com/molpro/documents');

print_r($xml);

PS: Already tried using the answer on this post - PHP cURL, extract an XML response but same result

MarlZ15199
  • 288
  • 2
  • 17

1 Answers1

0

I used Click2Mail SDK in Github and solved this

https://github.com/click2mail/php-5.6andOver-Click2Mail-ClientSDK

MarlZ15199
  • 288
  • 2
  • 17