Jump to content

Style xml pulled using curl in php external file?


dropfaith

Recommended Posts

Lets start with what i have working

http://www.treasuretrooper.com/api/116fcbdb1cac242e789a892ebd2a0abb/approved/xml pull that xml file (no style)

http://box1.host1free.com/~crimso/  is my current page as you see the xml file over in approved now (right side)

<?php



function getPage($url="http://www.treasuretrooper.com/api/116fcbdb1cac242e789a892ebd2a0abb/approved/xml"){
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_FRESH_CONNECT,TRUE);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,5);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,TRUE);
curl_setopt($ch,CURLOPT_REFERER,'http://www.treasuretrooper.com/');
curl_setopt($ch,CURLOPT_TIMEOUT,10);
$html=curl_exec($ch);
if($html==false){
  $m=curl_error(($ch));
  error_log($m);
}
curl_close($ch);
return $html;
}

$html=getPage("http://www.treasuretrooper.com/api/116fcbdb1cac242e789a892ebd2a0abb/approved/xml");
$html=htmlentities($html);
echo $html; 
?>

 

I just need t get the xml styled properly and im clueless as to how id do it with the curl function involved. So any direction would help tons on this.

 

Also wondering why its showing the actual xml code tree i assumed it would only provide the information

Link to comment
Share on other sites

sigh okay i cleared up all those issues  but im running into an issue with something small due to being forced to use curl im clueless on progress as i just learned it

 

i removed

$html=htmlentities($html);

 

Started styling it(im good on that now) 

BUt im having issues reversing its order right now its oldest date to newest.  I have a date field Approved_On to work with that all has info in it.

Also working on limiting the number of results to like 30  max . Again im dumb on this right now.  So anything helps

Link to comment
Share on other sites

What do you mean by "style XML" ? XML is pure information in tags, this is not HTML.

 

I suggest you insert all the data into a temporary database table, then select the data and sort on Approved_On column.

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.