APIs, cURL & E-mail articles

APIs, cURL & E-mail 1,316 Sending e-mail from your own code with PHPMailer A contact form, an order receipt, a password reset: sooner or later your code has to send an e-mail. The simple...
APIs, cURL & E-mail 1,100 Sending e-mail from PHP: mail() or SMTP Use SMTP with a real mailbox on your domain. The mail() function is fine for a quick test, but it returns “sent”...
APIs, cURL & E-mail 1,164 cURL error 28, 7 and 6 in PHP: timeout, connection refused and could not resolve host When your site calls an outside service (a payment, an API, an update) and it fails, PHP returns a cURL error...
APIs, cURL & E-mail 1,534 cURL error 60 in PHP: SSL certificate problem, and why not to switch verification off “cURL error 60: SSL certificate problem” means PHP connected to a service over HTTPS and did not trust the...
APIs, cURL & E-mail 1,098 Calling a web API from PHP with cURL and reading the JSON reply To talk to an API from PHP you use cURL: open a request, send it, read the status code (200, 401, 404…) and only...
APIs, cURL & E-mail 961 json_decode returns null: how to find out what is wrong with the JSON When json_decode returns null, PHP knows why: ask it. The function json_last_error_msg() gives the reason in words,...
APIs, cURL & E-mail 1,196 Callback URL or return URL: why a customer coming back is not proof of payment The short answer: an online payment usually involves two addresses of yours that the operator uses. The return URL...
APIs, cURL & E-mail 912 Timeouts, retries and idempotency: how not to charge a customer twice The short answer: when a request to an API times out, you do not know whether it got through. It may have failed...
APIs, cURL & E-mail 133 SMTP Relay in Laravel and other PHP frameworks: the .env settings and a first test e-mail The short answer: in Laravel, SMTP Relay goes in the .env file, without touching the code: server, port 587, the...