factmaven / xml-to-json Goto Github PK
View Code? Open in Web Editor NEWSimple API that converts dynamic XML feeds to JSON through a URL or pasting the raw XML data. Made 100% in PHP.
Home Page: https://api.factmaven.com/xml-to-json
Simple API that converts dynamic XML feeds to JSON through a URL or pasting the raw XML data. Made 100% in PHP.
Home Page: https://api.factmaven.com/xml-to-json
A user reached out to me saying they had an issue converting an XML feed:
https://api.factmaven.com/xml-to-json/?xml=https://nitter.net/official_kep1er/rss
This is the error is gives:
<br />
<b>Warning</b>: get_headers(https: //nitter.net/official_kep1er/rss): Failed to open stream: Connection timed out in <b>/home/factmaven/www/xml-to-json/index.php</b> on line <b>35</b><br />
<br />
<b>Warning</b>: Trying to access array offset on value of type bool in <b>/home/factmaven/www/xml-to-json/index.php</b> on line <b>36</b><br />
{
"error": {
"timestamp": "2022-05-18 12:17:00 EST",
"status": 0,
"title": "",
"detail": "The URL you provided does not point to an valid XML feed. Please check that you entered the correct URL.",
"url": "/xml-to-json/?xml=https://nitter.net/official_kep1er/rss"
},
"meta": {
"version": "2.0.2",
"copyright": "Copyright 2011-2022 Fact Maven",
"link": "https://factmaven.com/",
"authors": [
"Ethan O'Sullivan",
"Edward Bebbington"
]
}
}
It looks like there is some timeout issue with accessing the feed. I'll need to investigate further.
Right now you don't return any Cache-Control
and Expires
headers so every time the browser makes a request it downloads the whole response again.
I'm not sure what kind of caching you do on your side but it's unlikely that the xml would change every couple of minutes so I would at least have some client side caching.
Otherwise maybe you could have an extra parameter like &cache=30
which controls the amount of minutes after which the response expires.
I tried to use your service to convert the url below.
http://forex.ccb.com/cn/home/news/jshckpj_new.xml
https://api.factmaven.com/xml-to-json/?xml=http://forex.ccb.com/cn/home/news/jshckpj_new.xml
But the answer is not a standard JSON format.All keys are missing double quotes
First of all thank you very much for the really great tool.
Unfortunally I have faced a small issue that I haven't found a way to get around.
I'm in the middle of making a personal tool for the game ogame ( only for myself atm to practice ) nd I have always loved json over xml
But unfortunally their API uses sometime params within the url Their API info and what I have noticed as soon that I add their urls there uses params then it fails where it work fine when its a link there don't have params
Does anyone have a idea how to work around that issue
When I try to use this url as xml input it will give me "Start tag expected, '<' not found"
.
I am not too familiar with XML and some of this HTML syntax but it looks like there's a parsing error.
I believe <, a lesser than sign is being confused with an actual < or something. Can I fix this?
The API is working fine with URLs until one of them has a space in it. (I replaced the space with %20 before sending it.) But, I get this error:
{"error":{"timestamp":"2022-06-18 07:41:55 EST","status":400,"title":"Failed Loading XML","detail":["Start tag expected, '<' not found"],"url":"/xml-to-json/?xml=https://boardgamegeek.com/xmlapi/search?search=ticket%20to%20ride"},"meta":{"version":"2.0.2","copyright":"Copyright 2011-2022 Fact Maven","link":"https://factmaven.com/","authors":["Ethan O'Sullivan","Edward Bebbington"]}}
Here's the URL I used: https://api.factmaven.com/xml-to-json/?xml=https://boardgamegeek.com/xmlapi/search?search=ticket%20to%20ride
More than possible that this is my issue, but read through the other issues and comments. Might be the same issue as this?
I tried it with some other URLs and seems to fail when there's a %20.
This works: https://api.factmaven.com/xml-to-json/?xml=https://boardgamegeek.com/xmlapi/search?search=Crossbows
This doesn't: https://api.factmaven.com/xml-to-json/?xml=https://boardgamegeek.com/xmlapi/search?search=Crossbows%20and
Thanks for any help you can offer!
Running into cases where because the XML i'm trying to parse is so large, passing it as a query string results in a an error: URI too long
You can use this as an example input: https://boardgamegeek.com/xmlapi2/thing?id=13&versions=1&stats=1
It'd be great if your API could also support a POST method to pass the data in as the body
?
I'm having trouble trying to parse XML from this link:
http://www.managerzone.com/xml/team_league.php?sport_id=1&league_id=16222
Just because of the ampersand, the API considers it as a new parameter so it parses the content of this link instead:
http://www.managerzone.com/xml/team_league.php?sport_id=1
Probably this would help:
The api returns an error when the xml contains characters such as ร.
Would it be possible to make it work for all characters?
eg https://api.domain/xml-to-json?xml=<name>ed</name>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.