PHP examples for JSON
- Uses the file_get_contents function
- Uses the cURL library
Verify the SSL certificate
When using the SSL protocol with PHP prior to version 5.6.0, verification of the remote server's SSL certificate might be disabled by default, which may lead to man-in-the-middle attacks. If verification is enabled, you may need to specify the path to the certification authority's root certificate.
We recommend enabling verification and, if necessary, setting the path to the CA root certificate file on the local computer.
The Yandex.Direct API servers use an SSL certificate issued by the CERTUM certification authority. You can download the root certificate from the CA's website: https://www.certum.eu/certum/cert,expertise_root_certificates.xml#CCA. Go to the section Certum root certificates and click the link Download: PEM (for the CA.pem file).
Each example includes a section with instructions on enabling SSL certificate verification and setting the path to the root certificate.