curl to automate HTTP jobs : Working with Curl command

curl

Curl is a command line tool for doing all sorts of URL manipulations and transfers. Curl is not written to do everything for you. It makes the requests, it gets the data, it sends data and it retrieves the information. Trace time delay of URL with curl Many times we need to know what exactly is … Read more

curl api using variable post/get method

HI every one there are lot of confusion about curl may be you understand easily …    $url= “phone=$phone&leadid=$leadid”; //initialized other variable $header = array(“Accept: application/json”);                        //optional for json format. $ch = curl_init();                        … Read more

convert backslash to forward slash vice versa

Hi Guys, this is very easy method to replace the special character with in string  . Example $var  = “/var/xyz/html/uploaddata/xyz.html”; “/”replace with “-”  $str = str_replace(‘/’, ‘-‘,  $var); result is -var-xyz-html-uploaddata-xyz.html Example     $var  = “var-xyz-html-uploaddata-xyz.html”; “-“replace with “/” $str = str_replace(‘-‘, ‘/’,  $var); result is /var/xyz/html/uploaddata/xyz.html “/”replace with “\”  Example $var  = “/var/xyz/html/uploaddata/xyz.html”; $test = str_replace(‘/’, “\\”, $var … Read more

Convert datetime to specific formats in PHP

There are many way to use date time with specific combination with format  in PHP.. dd/mm/yyyy 18/04/2016 $userdefine = date(“d/m/Y”, $datetime); echo $userdefine; mm/dd/yyyy 04/18/2016 $userdefine= date(“m/d/Y”, $datetime); echo $userdefine; Without mins/seconds 18 April 2016  $userdefine= date(“d F Y”, $datetime); echo $userdefine; With mins/seconds 18 April 2016 10:12:59  $userdefine= date(“d F Y H:i:s”, $datetime); echo $userdefine;   There are same other formats like $userdefine= date(“m-d-Y”, $datetime); echo $userdefine; —output like … Read more

PHP Video File Upload in Server

Configure The “php.ini” File in local server or Linux ,Centos.for In your “php.ini” file, search for the file_uploads directive, and set it to On: For centos or linux you need to configure the these changes in server. /etc/php.ini upload_max_filesize = 2M file_uploads = On change the upload_max_filesize = userdefine size ;upload_tmp_dir = uncomment the variable … Read more

PHP MySQL Database Connection

php-mysql

PHP 5 and later can work with a MySQL database using: MySQLi extension (the “i” stands for improved) PDO (PHP Data Objects) Earlier versions of PHP used the MySQL extension. However, this extension was deprecated in 2012. Open a Connection to MySQL   Example: <?php $servername = “localhost”; $username = “username”; $password = “password”; // … Read more

PHP Cron Job: How to Execute PHP file Using Crontab in Linux

There are various method to execute php file via crontab in linux. Here is the details of all the method: Method 1: Run the php script using URL from the crontab If your php script can be invoked using an URL, you can lynx, or curl, or wget to setup your crontab as shown below. … Read more

php ltrim function : php remove left string

php left trim function

Remove characters from the left side of a string: Example <?php $str = “Hello World!”; echo $str . “<br>”; echo ltrim($str,”Hello”); ?> Output: World!