• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Save a json file content inside a variable

Explorer ,
Mar 16, 2018 Mar 16, 2018

Copy link to clipboard

Copied

I have this url https://marketplace.envato.com/api/edge/audaciousleap/mnk79e4cztu4sgbyjqbzp... . I need to get that text. I have no idea how to do that, and it seems that it could be so simple. I have searched a lot through the web but found no real solution. Almost all involved jQuery, and i don't think that works with extendscript. The closest i got was this, but i got an error for direct ip not allowed.

reply = "";

conn = new Socket;

if (conn.open("marketplace.envato.com:80")) {

    // send a HTTP GET request

    conn.write("GET /api/edge/audaciousleap/mnk79e4cztu4sgbyjqbzpje0j8v914n0/verify-purchase:2acfeef0-a573-4797-91bb-1b85855e7f62.json HTTP/1.0\n\n");

    // and read the server’s reply

    reply = conn.read(999999);

    alert(reply);

    conn.close();

}

I have this example from javascript tools guide CC at page 194.. The original code was:

reply = "";

conn = new Socket;

// access Adobe’s home page

if (conn.open ("www.adobe.com:80")) {

     // send a HTTP GET request

     conn.write ("GET /index.html HTTP/1.0\n\n");

     // and read the server’s reply

     reply = conn.read(999999);

     conn.close();

}

TOPICS
Scripting

Views

287

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation