Skip to main content

Posts

Showing posts from December, 2017

Backup and Restore Mysql Database

1.mysqldump allows you to backup a single database and multiple databases as well. 2.Now, assume that you want to take backup of database named source. Backup Single Database: mysqldump source > destination.sql Backup Multiple Databases: mysqldump --databases source-one source-two source-three > destination3.sql 3.Restore MySQL Database mysqldump source < destination.sql source is the name of database you want to restore and destination.sql is the backup file to be restored.

What is cURL(Client URL) in Php?

-Whenever we make a HTTP request,we can make use of http methods like GET,POST,PUT..etc. -If we want to use REST API's,we need a client which has the capability to use all HTTP methods.Here,HTTP is limited in this case. -So,we need a client library,that's were CURL comes into play.We use CURL while consuming REST API's. -Consuming a REST API using Php 1.curl_init() : Establishes a connection 2.curl_setopt($ch,int $option,mixed $value) : Add/Make a request 2.1.curl handled by curl_init(). 2.2.CURLOPT_XXX option to set.Example : CURLOPT_URL. 2.3.$value is the value for option.Example : https://www.google.co.in for CURLOPT_URL. 3.curl_exec() :Executes the request by taking the curl handled by curl_init(). 4.curl_close() :Closes the connection. Example: $ch=curl_init(); curl_setopt($ch,CURLOPT_URL," https://www.google.co.in "); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $response=curl_exec($ch); curl_close($ch); print $result; //re

How to Integrate SMS API's with PHP?

<?php $message  =  "Happy Coding..A Test Message to Check API" ; $students  =  "9999999999"  //your mobile number to test $msg  =  urlencode ( $message );          $url = "http://www.bulksmsapps.com/api/apibulkv2.aspx?apikey=XXX-XXXX-XXXX-XXX-XXXXXXXX&sender=XXXXX&number=" . $students . "&message=" . $msg ; $curl_handle = curl_init (); curl_setopt ( $curl_handle , CURLOPT_URL , $url ); curl_setopt ( $curl_handle , CURLOPT_RETURNTRANSFER , 1 );  curl_setopt ( $curl_handle ,  CURLOPT_FOLLOWLOCATION ,  false ); set_time_limit ( 0 ); $response  =  curl_exec ( $curl_handle ); err  =  curl_error ( $curl_handle ); curl_close ( $curl_handle ); if ( $err ) {     echo  "cURL Error #:"  .  $err ; } else {     echo  $response ; } ?>

What is SSH?How to install SSH?

SSH:         1.Secure Socket Shell.         2.SSH is program and protocol for securely logging into remote machines  across a network. It allows you to run programs, and do a variety of tasks as if you were sitting at the machine. Example:                   If a person is accessing computer A,and at the same time,you want to access the files which are present on computer A,then at that situation you can use SSH from your terminal as follows.                ssh -X Computer_A_IP_ADDRESS As both can access the files on one machine without affecting each others work. Installation:                         sudo apt-get install openssh-server Enter password of computer_A Enter yes then from your computer try to access your computer_A using ssh Computer_A_IP_Address.

What is the difference between remove,purge and autoremove in UBUNTU LINUX?

sudo apt-get remove <package>:                                     It will remove only the packages but not the configuration files. sudo apt-get purge <package>:                                          It will remove both the package and configuration files. sudo apt-get autoremove:                                               It can be used without specifying a package.It removes the configurations,packages that are no longer needed. Example:                                  When You install package A,then package B and C gets installed as dependencies for package A.But when we uninstall package A,then B and C lefts installed.so here in this case,sudo apt-get autoremove searches the system for packages that are installed as dependecies and no longer be used like B and C,removes them.

What is the difference between a website,webpage and web browser?

Website:                 A collection of web pages.for example,Flipkart,Amazon.com are websites.They contain many webpages. Webpage:                   Webpages are written in html.They can either be static or dynamic.Static means they show the same content whenever you visit.for example,college webpages remain static.Dynamic means the content gets changed day-by-day.for example,Amazon webpage(front page) change dynamically based on some offers. Web Browser:                           Web browser is a place where you try to access and view the websites. for example,Google chrome,Firefox,IE are Web browsers.