Search code examples
htmljsongetrequestanimated-gif

How to get desired response the way https://doesthisgifcontainananimation.com requests it?


Here's what site says and I just don't get it:

enter image description here

When accessing site with something like, for example:

https://doesthisgifcontainananimation.com/[URL http://i.imgur.com/tYqyhJT.gif URL]

all I get is just

{"error":"url_parsing_failed"}

I plan to use this along with a custom RSS feed in PHP to show entries classified regarding its content and in this case, also considering image type (Animated and non animated GIF's).

Any word of help is appreciated. Thanks in advance.


Solution

  • http%3A%2F%2Fi.imgur.com%2FtYqyhJT.gif
    

    Encoding means replacing slashes, colons and every single character on the URL that makes it being treated like an address, using their hex values preceded with a percent character, making it merely a parameter. The Full URL then is:

    https://doesthisgifcontainananimation.com/http%3A%2F%2Fi.imgur.com%2FtYqyhJT.gif
    

    The browser doesn't make this for you...at least not in this case.

    Apologies for being dumb(er) at the beginning. All I can say now is that

    https://doesthisgifcontainananimation.com/[URL encoded gif URL]
    

    is as unclear as my past problem.

    php code I used then is

    $url="http://i.imgur.com/tYqyhJT.gif";
    $encoded="https://doesthisgifcontainananimation.com/".urlencode($url);
    

    And about encoding, more information here