I’m trying to fetch a wallet from Moralis, to display the NFTs held in it.
Limitation: I can’t use composer (and hence not the Web3 SDK), but I don’t need all its functionality.
The code below returns a wallet, but since it’s the development server, it stops working.
I like to use this code now on my own server: “https://txvxu97okj3q.usemoralis.com:2053”
How do I do this with Curl in PHP?
Especially: how do I set the Application ID and Master Key?
<?php
$address = '0x837ca59C72bDCc902Ae1aabf9B5E49caa628cd80'; // Aidan Cullen's Wallet
$url = 'https://deep-index.moralis.io/api/v2/'.$address.'/nft';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'X-API-Key: <Key-Was-Here>'));
$res = curl_exec($ch);
curl_getinfo($ch, CURLINFO_HTTP_CODE);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$responsecode = curl_getinfo($ch,CURLINFO_RESPONSE_CODE);
curl_close($ch);
echo "<p>Code = $httpcode<BR />Response = $responsecode</p>";
$data = json_decode($res,true);
echo '<pre>';
print_r($data);
echo '</pre>';
?>