Posts Tagged ‘exception in php’

Check Site Loading Speed using CURL curl_getinfo() in PHP.

Monday, June 22, 2009 10:06 3 Comments

We use curl_getinfo() in to get the information of last transfer that made use of curl functions in PHP.  Using the following code we can get the time taken to load a webpage. $ch = curl_init(‘http://www.inetminds.com/parsing-xml-feeds-in-php-with-simplexml-111/’); // set  cURL to return the contents in a variable instead of giving it to the browser. curl_setopt($ch, CURLOPT_RETURNTRANSFER, [...]

This was posted under category: PHP, Programming Tags: , , , , , ,

throw Exception in php

Friday, October 31, 2008 9:52 No Comments

try { doExchange(); throw new Exception(“D’oh!”); echo “hai”; } catch (Exception $except) { logger.error(“doExchange failed”, e); } In that example, PHP enters the “try” block and starts executing code. When it hits the line “throw new Exception”, it will stop executing the “try” block, and jump to the “catch” block. Here it checks each exception [...]

This was posted under category: PHP, Programming Tags: , ,

try and catch block in php

Thursday, October 30, 2008 8:47 1 Comment

Exception handling is used to change the normal flow of the code execution if a specified error (exceptional) condition occurs. This condition is called an exception. Try block is used to try for the code to execute if any error like file unable to open etc.. It will stop the execution and it will throw [...]

This was posted under category: PHP, Programming Tags: , , ,