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();
}
Have something to add?