Jump to content

XML output with CSS styling


iangessey

Recommended Posts

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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.