![]() |
Loading Mailjet API - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Model-View-Controller (https://forum.codeigniter.com/forumdisplay.php?fid=10) +--- Thread: Loading Mailjet API (/showthread.php?tid=83478) |
Loading Mailjet API - kcs - 09-29-2022 Hi everyone, I am trying to create a newsletter subscription form using the Mailjet API. I have never used an API before and don't really know what I am doing wrong, but it looks like I am not even able to load the Mailjet class and would really appreciate some help. My form as just 2 text input, one for email address and a hidden one for the locale I will need later. I am following the documentation https://github.com/mailjet/mailjet-apiv3-php.
The documentation says to initalise the Mailjet client like this: Code: use \Mailjet\Resources; PHP Code: <?php But when I look at the loaded files on the debug console, I don't see anything related to Mailjet ; and already inside my IDE, I can see that the use clause remains grey (if I use \codeigniter it appears white), so I am thinking something is missing at this point, or I am not doing things the way I should. Can someone help me out? RE: Loading Mailjet API - superior - 09-29-2022 I believe the first slash on 'use \Mailjet\Resources;' should be 'use Mailjet\Resources', doesn't Mailjet have a Exception handler to check if something has gone wrong with the communication? RE: Loading Mailjet API - kenjis - 09-29-2022 Why don't you show the code for the api call in the controller? RE: Loading Mailjet API - kcs - 09-29-2022 (09-29-2022, 02:54 AM)superior Wrote: I believe the first slash on 'use \Mailjet\Resources;' should be 'use Mailjet\Resources', doesn't Mailjet have a Exception handler to check if something has gone wrong with the communication? Thank you so much, that was it ![]() I was not seeing anything return as the example seems to only show the result when it works with this line: Code: $response->success() && var_dump($response->getData()); But I was not seeing anything... and since I don't really understand what I am doing for now... I have no idea how to try something different than what I am getting from the documentation explicitly. (09-29-2022, 04:06 AM)kenjis Wrote: Why don't you show the code for the api call in the controller?Sorry I thought it was not relevant at this point. Thanks for your help |