Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7616667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:56:41+00:00 2026-05-31T02:56:41+00:00

I just created an account on 500px.com, and would like to use their API:

  • 0

I just created an account on 500px.com, and would like to use their API: http://developer.500px.com/

But it looks like it cant return JSONP, only JSON.

Is there any way to make a php file that you can post a url to -> make it convert the response from the api from JSON to JSONP, so i can handle it on the client side?

I havent been writing any PHP in a long time, so any help is appreciated. Hope you get the idea, otherwise ill elaborate. Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T02:56:42+00:00Added an answer on May 31, 2026 at 2:56 am

    Sure you can. The only difference between JSON and JSONP is that JSONP is wrapped with a function name;

    { "x": "hello" } // JSON
    foo({ "x": "hello" }); // JSONP.
    

    In it’s simplest form you can end up with something like this;

    <?php echo $_GET['callback']; ?>(<?php echo file_get_contents($_GET['endpoint']); ?>);
    

    and you’d expect clients to use it like this;

    http://yourserver.com/proxy.php?endpoint=https%3A%2F%2Fapi.500px.com%2Fv1%2Foauth%2Fauthorize&callback=foo
    

    Note the encoded URL and the addition of the callback parameter to know which function to invoke.

    Of course, you’ll need to valid the input; check the existance of the parameters, check the endpoint passed isn’t malicious etc. You might want to also cache the responses on your server to stop you reaching any limits imposed on the API.

    Something more resilient against malicious input could look like;

    // checks for existence, and checks the input isn't an array
    function getAsString($param) {
        if (is_null($_GET[$param]) || !is_string($_GET[$param])) {
            return '';
        }
    
        return $_GET[$param];
    }
    
    $endpoint = getAsString('endpoint');
    // check callback is only alpha-numeric characters
    $callback = preg_replace('/[^\w\d]/', '', getAsString('callback'));
    // check the endpoint is for the 500px API
    $is_api = (strpos($endpoint, 'https://api.500px.com') === 0);
    
    if (strlen($callback) > 0 && $is_api) {
        echo $callback . '(' . file_get_contents($endpoint) . ')'
    } else {
        // handle error
    }
    

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm kinda new to GitHub, and I just created my account and set it
Just created a WSS site with a some custom web-parts. But I get an
I just created a user control. This control also makes use of my static
I just created an iPhone app and am having friends try it out, but
I would like the users be able to create their accounts (which stores the
I just set up a Beanstalk account and created a repository using git. My
I just created a bunch of routes with Devise, but one notable route was
Ive just activated my Azure account, created ny first Asp Mvc 3.0 project (just
We created an application profile using our company's Facebook account. Today, I've just finished
I am very new to Github. I just created one github account and it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.