Comments (13)
Can you describe what sort of result array you want?
from api.
Sure thing. For example, if I get the data at this URL for FontAwesome:
http://api.jsdelivr.com/v1/bootstrap/libraries/font-awesome/?fields=versions
I get the following output:
[
{
"versions": [
"4.0.3",
"4.0.2",
"4.0.1",
"4.0.0",
"3.2.1",
"3.2.0",
"3.1.1",
"3.1.0",
"3.0.2",
"3.0",
"2.0"
]
}
]
I can get that text in PHP, but my question is how do I turn that into a
PHP array that looks like this:
$versions = array(4.0.3, 4.0.2, 4.0.1, etc. . . )
An array upon which I can perform normal PHP operations and looping. Does
that make sense?
Thanks! Any help would be much appreciated :)
from api.
You probably should apply json_decode on the result. That will give you an array like above.
In JavaScript (Node.js) the operation you want would look like this:
var request = require('request');
request.get('http://api.jsdelivr.com/v1/bootstrap/libraries/font-awesome/?fields=versions',
{
json: true
},
function(err, res, data) {
if(err) {
return console.error(err);
}
var versions = data[0].versions;
console.log(versions);
}
);
You should be able to achieve something similar in PHP easily.
from api.
Awesome! I didn't even know that was JSON - learn something new every day.
Thanks again.
On Mon, Mar 24, 2014 at 11:46 PM, Juho Vepsäläinen <[email protected]
wrote:
You probably should apply json_decodehttp://be2.php.net/manual/en/function.json-decode.phpon the result. That will give you an array like above.
In JavaScript (Node.js) the operation you want would look like this (not
tested):var request = require('request');
request.get('http://api.jsdelivr.com/v1/bootstrap/libraries/font-awesome/?fields=versions', {json: true},
function(err, res, data) {
if(err) {
return console.error(err);
}var versions = data[0].versions; console.log(versions); });
You should be able to achieve something similar in PHP easily.
Reply to this email directly or view it on GitHubhttps://github.com//issues/29#issuecomment-38535256
.
from api.
Ok. I guess it's safe to close this issue.
If there are any other problems or you need something specific, just poke.
from api.
@MickeyKay Hey, your WordPress plugin very good.
Any chance you could a dropdown to allow users to choose what CDN to use and add us there too? :)
from api.
Not sure exactly what you mean? Can you clarify? Are you referring to
Better Font Awesome?
On Mon, Apr 21, 2014 at 11:05 AM, Dmitriy Akulov
[email protected]:
Hey, your WordPress plugin very good.
Any chance you could a dropdown to allow users to choose what CDN to use
and add us there too? :)Reply to this email directly or view it on GitHubhttps://github.com//issues/29#issuecomment-40958944
.
from api.
Yes, Better Font Awesome. We too host FontAwesome http://www.jsdelivr.com/#!fontawesome
More info about jsDelivr https://hacks.mozilla.org/2014/03/jsdelivr-the-advanced-open-source-public-cdn/
You could add a dropdown allowing the user to select the CDN he wants to use to load FontAwesome. Let me know what you think :)
from api.
@MickeyKay jsDelivr uses the both the MaxCDN that BootstrapCDN uses & CloudFlare's CDN (plus a few extra PoPs in the CDN)
from api.
Ahhh, I see. Are there advantages to one vs. the other. This sounds like a
great feature to add, but I'd like to know what the reasons for/against are
before I start drawing up the code. Thanks!
On Mon, Apr 21, 2014 at 11:44 AM, tomByrer [email protected] wrote:
@MickeyKay https://github.com/MickeyKay jsDelivr uses the both the
MaxCDN that BootstrapCDN http://www.bootstrapcdn.com/extras/birthdayuses & CloudFlare's CDN (plus a few extra
PoPs in the CDN http://www.jsdelivr.com/network.php)Reply to this email directly or view it on GitHubhttps://github.com//issues/29#issuecomment-40963049
.
from api.
It offers a choice to users which is a good thing :)
Other than that the main difference is in infrastructure. You can read the mozilla blog post and our readme here for more info https://github.com/jsdelivr/jsdelivr
from api.
Happy to report that Better Font Awesome plugin for WordPress (
https://wordpress.org/plugins/better-font-awesome) now offers the ability
to choose your CDN (jsDelivr or Bootstrap), with jsDelivr as the default!
Thanks for the great suggestions and all the help. Feel free to spread the
word about the plugin too :)
On Mon, Apr 21, 2014 at 3:29 PM, Dmitriy Akulov [email protected]:
It offers a choice to users which is a good thing :)
Other than that the main difference is in infrastructure. You can read the
mozilla blog post and our readme here for more info
https://github.com/jsdelivr/jsdelivrReply to this email directly or view it on GitHubhttps://github.com//issues/29#issuecomment-40984561
.
from api.
Thank you! Will do
from api.
Related Issues (20)
- Version sorting HOT 10
- API returns no versions (urgent) HOT 5
- Move the API away from AppFog HOT 8
- Am I right to assume that I cannot get data for multiple librarys with one api call? HOT 4
- Searching by URL HOT 1
- jQuery failed to update latest beta1 HOT 2
- File paths HOT 14
- Incorrect author format for some CDNJS projects HOT 3
- pagination need? HOT 3
- The result order is not right HOT 3
- Default filename for specified version HOT 8
- API is not detecting new projects HOT 2
- Specify Content Security Policy? HOT 1
- API future HOT 3
- Add SRI to API HOT 1
- Add a download/hit count to the API HOT 7
- API endpoint down? HOT 2
- "bootstrap" alias is gone in v1 HOT 7
- Remove X-Requested-With
- Make sure logentries is utilized HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from api.