iangessey Posted February 3, 2015 Share Posted February 3, 2015 Hi Bit new to this so bear with me. I have an API call that outputs to a .php file (the data in the file appears to be xml - no format). Can you please advise if i would link this to a .css file as per .html to get the formatting i require...if so, can you offer a suggestion on the syntax? This is my API call: <?php $apiKey = "api key"; $secretKey = "its a secret"; $apiURL = "http://some url"; $requestController = "/Tickets/TicketStatus"; // Generates a random string of ten digits $salt = mt_rand(); // Computes the signature by hashing the salt with the secret key as the key $signature = hash_hmac('sha256', $salt, $secretKey, true); // base64 encode... $encodedSignature = base64_encode($signature); // urlencode... Not required for POST and PUT requests. //$encodedSignature = urlencode($encodedSignature); //Sample Ticket Creation. $postFields = array( "apikey" => $apiKey, "salt" => $salt, "signature" => $encodedSignature); //Build query for POST request. $postData = http_build_query($postFields,'', '&'); // set URL and other appropriate options $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $apiURL.$requestController.'&'.$postData); curl_setopt($ch, CURLOPT_HTTPGET, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET'); $http_result = curl_exec($ch); $error = curl_error($ch); $http_code = curl_getinfo($ch ,CURLINFO_HTTP_CODE); curl_close($ch); echo '<pre>'; print_r (htmlentities($http_result)); echo '</pre>'; ?> This generates a file back with all my lovely data in a text file type format. My requirement is to pretty it up, but in this first step, i just need to link this output .php file to a .css or .xml(?). Thanks Ian Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.