07-27-2015, 04:07 AM
I want to create a plug-ins which will need to validate the username and password in web, upon sucessful of login, it should collect address and images from the web.
07-27-2015, 04:07 AM
I want to create a plug-ins which will need to validate the username and password in web, upon sucessful of login, it should collect address and images from the web.
07-27-2015, 08:25 AM
You can use our InternetGET and InternetPOST classes for this, which allow for both synchronous and asynchronous HTTP(S) GET and POST requests (respectively). A synchronous request will block the owning thread (so if you want/need to manage your own threads this is the way to go), and an asynchronous request will run in a background thread.
08-05-2015, 04:18 AM
(07-27-2015, 08:25 AM)garrett Wrote: You can use our InternetGET and InternetPOST classes for this, which allow for both synchronous and asynchronous HTTP(S) GET and POST requests (respectively). A synchronous request will block the owning thread (so if you want/need to manage your own threads this is the way to go), and an asynchronous request will run in a background thread. Thanks for the input. But im currently facing issues in getting it running. Is there any sample available that I could refer for this. Thank you.
08-05-2015, 03:58 PM
There are currently no sample projects that include this functionality, but here is a quick code sample that should work.
Add the following to the header file of the Plugin class in the Skeleton sample project: Code: hdi::core::InternetGET* ipChecker; Then add the following to the definition of the postStartup() member function in the implementation file of the Plugin class in the Skeleton sample project: Code: this->ipChecker = hdi::core::InternetGET::Async( Finally, add the following somewhere in the implementation file of the Plugin class in the Skeleton sample project: Code: void skel::Plugin::ipCheckSuccess() Once you compile and run the Skeleton project, you will see the same HTML code printed in the debugger as if you had visited http://checkip.dyndns.com/ (in your browser). If the URL cannot be successfully loaded, then the failure callback will execute instead and you will see the error string printed in the debugger. On Windows you might have to use OutputDebugString() instead of std::cout.
03-04-2017, 03:33 PM
(This post was last modified: 03-05-2017, 09:09 AM by Rick Johnson.)
Looking through the header notes I found "Asynchronous InternetGET objects must be allocated using operator new" and wondered if the first line of this example allocated as if "new" was somehow implicit:
Code: this->ipChecker = hdi::core::InternetGET::Async( If I change this to add "new" then I get a syntax error that Async is not a type. I can't create an empty instance and then add the Async info later: Code: this->ipChecker->Async(... ...because I cannot create an instance without including the parameters, and calling ->Async with the required parameters crashes at runtime. The example code first provided has worked well for me for both async POST and GET, but when a fluke at my web host caused a permissions error, all of my plugins crashed Illustrator in the HTTP call rather than fail gracefully as they did when the server was eventually shut down. I want to ensure that Async calls are done correctly, so any clarification would be very much appreciated.
03-07-2017, 12:23 PM
It's implied that hdi::core::InternetGET::Async() uses operator new internally, because the other part of the function docs says "The responsibility for the memory of the returned InternetGET pointer lies with the caller, and it must not be deleted until after either the success or failure callbacks are called." I have just updated the docs to be more explicit in this regard.
03-07-2017, 08:34 PM
Thanks, Garrett!
|
|