Category Archives: PHP

How to compress an image using imagemagick in PHP?

(first instal imagemagick into the server, then it will set the path as follows) $imagemagicpath=’usr/bin’ //usualy this is the path for image magick $source=’images/first.jpg’; //first.jpg is renamed to converted.jpg //Specifying destination path $destination=’images/converted.jpg’; //path for imagemagic function //specify quality here $cmd=$imagemagicpath.”/convert “.$source.” -quality 10% “.$destination; //above line is executing here exec($cmd); this will reduce the… Read More »

How to use Stored Procedures in PHP

see this simple example To calculate the area of a circle with given radius R, the following commands can be given delimiter // create function Area (R double) returns double deterministic begin declare A double; set A = R * R * pi(); return A; end // delimiter ; And to call it from php… Read More »

Fatal error: Call to undefined function curl_init() Windows

If you are having the error Call to undefined function curl_init() in Windows, then you have to simply modify a line in apache’s php.ini file. Goto your xaampfolder, find out php.ini in bin folder and open it in a text editor. Find the text extension=php_curl.dll and remove the semi-colon at the start. Now that line… Read More »

structure of stored procedures

Defining procedures or functions is a two-step process: Define the name of the procedure or function, and set its parameters. Define the body of the procedure or function between BEGIN and END statements. Here’s the basic syntax: CREATE PROCEDURE procedure_name ([procedure_parameter[,…]]) routine_body The procedure_parameter is a list of parameters and their directions, composed using the… Read More »

Sample Rest aPi call in php using curl

$service_url = ‘http://mydoubts.com’; $inputdata='<?xml version=”1.0″ encoding=”utf-8″?> <username>mydoubts</username> <domain>mydoubts.in</domain> <email>contact@mydoubts.in</email>’; curl_setopt($curl, CURLOPT_HTTPHEADER, array(“Content-Type: application/xml”)); curl_setopt($curl, CURLOPT_POST, true); // Do a regular HTTP POST curl_setopt($curl, CURLOPT_POSTFIELDS, $inputdata); // Set POST data curl_setopt($curl, CURLOPT_URL, $service_url); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_HEADER, 1); // return HTTP headers with response curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $response = curl_exec($curl);

How to pass data if browser does not support cookies.

In this case you can use Post method see the example below create one php/html file : <html> <body> <form action=”output.php” method=”post”> Name: <input type=”text” name=”name”> <input type=”Submit” name=”Submit”> </form> </body> </html> if you execute the above page values will comes in the output.php file <?php echo $_POST[“name”]; ?>