Posts

Showing posts from May, 2018

Get only domain name from email using PHP.

Image
Sometimes you need to extract domain name from email using PHP for whatever reason, in that case you can use code sample :

How can I debug PHP cURL sessions?

Setting CURLOPT_HEADER and CURLOPT_VERBOSE to 'true' are two of the most important ways to debug PHP cURL sessions.  Detailed Description PHP’s cURL library is widely used by PHP applications to communicate with the eBay API. However, debugging cURL sessions can be problematic.  Since many of eBay’s services require proper information in the HTTP headers, verifying correct header transfer is important. This can be done by setting the CURLOPT_HEADER to 'true'.  Setting CURLOPT_VERBOSE to 'true' will display two-way communication between the PHP application and the server.  You can also use curl_getinfo to get error messages.  Sample Code and Session for CURLOPT_VERBOSE <?php $headers = array ( 'X-EBAY-API-COMPATIBILITY-LEVEL: 507', 'X-EBAY-API-DEV-NAME: ABCD', 'X-EBAY-API-APP-NAME: EFGH', 'X-EBAY-API-CERT-NAME: IJKL', 'X-EBAY-API-SITEID: 0', ); $session = curl_init(); curl_setopt($session, CURLOPT_URL, &