Really like the idea and it works a treat! However, instead of using Simple HTML Dom to get the latest version, have you considered using RSS? E.g: http://vanillaforums.org/addon/memberslistenh-plugin.rss. Should be much easier and much more efficient
P.S.: The RSS feed contains some pretty useful stuff
thx. businessdad - By the time I read your message. I had already rewritten the program. just like you said. Maybe you were channeling thoughts. Now - what does that mean??? .
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
use ProxyRequest, it is the native function for exactly this, and simplifies the connection and retrieval.
It is curl based, by the other methods are not requirements, curl is a requirement usually, so it is consistent.
for some reason vanillaforums.org does not allow for JSONP where as vanilla 2.0 and 2.1 automatically pick up the callback and turn he JSON into JSONP.
Otherwise you could connect directly with jQuery.
You could still do it on the client side, by proxying it through a local location and using ProxyRequest, then just sending the valid JSON back.
this function checks for curl, if not there it uses fsockopen, which has marginally more support than file_get_contents
That's good to know. The only thing I found odd is that cURL seems to be significantly slower than fsockopen(). I used them both when I developed my Advanced Logger, and I had to replace cURL because it was sluggish (it was for POSTing data, though, not for retrieving it).
Comments
Really like the idea and it works a treat! However, instead of using Simple HTML Dom to get the latest version, have you considered using RSS? E.g: http://vanillaforums.org/addon/memberslistenh-plugin.rss. Should be much easier and much more efficient
P.S.: The RSS feed contains some pretty useful stuff
Kasper Kronborg Isager (kasperisager) | Freelance Developer @Vanilla | Hit me up: Google Mail or Vanilla Mail | Find me on GitHub
why not json?
http://vanillaforums.org/addon.json/1077/version-check
grep is your friend.
There it was! Couldn't find the right URL for the JSON and XML feeds
Kasper Kronborg Isager (kasperisager) | Freelance Developer @Vanilla | Hit me up: Google Mail or Vanilla Mail | Find me on GitHub
general format is
controller.json/somemethod/args
Alternatively
http://vanillaforums.org/addon/1077/version-check?DeliveryMethod=JSON&DeliveryType=DATA
grep is your friend.
I actually thought it was
controller/method.[json/xml]/args
- thanks for pointing it out!Kasper Kronborg Isager (kasperisager) | Freelance Developer @Vanilla | Hit me up: Google Mail or Vanilla Mail | Find me on GitHub
Yeah, peregrine is running hot, great thanx.
thx for the tips - guys. I'll look in to changing it. Glad you like the idea.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
As an example - would I be retrieving this in a file_get and parsing or is there a better idea.
http://vanillaforums.org/addon/versioncheck-plugin.xml?DeliveryMethod=JSON&DeliveryType=DATA
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
There are several ways to get the data:
file_get_contents()
, which you already mentioned.fsockopen()
andfread()
.I would do something like this, more or less:
json_decode()
, transform the JSON into a PHP object.My shop | About Me
thx. businessdad - By the time I read your message. I had already rewritten the program. just like you said. Maybe you were channeling thoughts. Now - what does that mean??? .
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
use
ProxyRequest
, it is the native function for exactly this, and simplifies the connection and retrieval.It is curl based, by the other methods are not requirements, curl is a requirement usually, so it is consistent.
for some reason vanillaforums.org does not allow for JSONP where as vanilla 2.0 and 2.1 automatically pick up the callback and turn he JSON into JSONP.
Otherwise you could connect directly with jQuery.
You could still do it on the client side, by proxying it through a local location and using ProxyRequest, then just sending the valid JSON back.
grep is your friend.
.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
@x00 I used this
version 1.1 based on kasper's idea for speed and your further ideas up until the proxyrequest change.
$getlink = 'http://vanillaforums.org/addon/versioncheck-plugin.xml?DeliveryMethod=JSON&DeliveryType=DATA';
I'll have to study up on proxyrequest or if you can take a look at the program and pass on some pointers.
It is extremely fast using the file get
file_get_contents($getlink);
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
file_get_contents external urls are often blocked on some hosts, especially php safemode.
grep is your friend.
>
You don't need the
.xml
bitgrep is your friend.
@x00 said:
I grok you.
sooner or later I'll try another update if anyone has some issues with file_get_contents . meanwhile this will probably work for most.
thx.
it works with .xml, but I will update if I do the proxryequest thing.
thanks for all the great ideas everyone.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
$Data = ProxyRequest($Url);
this function checks for curl, if not there it uses fsockopen, which has marginally more support than file_get_contents
grep is your friend.
what I meant is it is json not xml, the xml bit isn't relevant.
grep is your friend.
also these other functions have timeouts it is important to have sensible timeouts. The default is a second.
grep is your friend.
That's good to know. The only thing I found odd is that cURL seems to be significantly slower than
fsockopen()
. I used them both when I developed my Advanced Logger, and I had to replace cURL because it was sluggish (it was for POSTing data, though, not for retrieving it).My shop | About Me