Posts

Showing posts from July, 2015

How to pass objects in php function

This is the simple way to pass object in php  function .Before run these codes you should aware of following files. 1. Khunt.php :-                     This is the main class file. 2. ReqMsgDTO.php :-          This file have setter and getter properties. 3. Sale.html :-                       This file basically provides the User Interface along with Order Id and Mid. 4. test.php  :-                        This file will  invoke the generateTrnReqMsg($object) along with pass object .                                          1. Khunt.php <?php  include("ReqMsgDTO.php"); class Khunt     {   function generateTrnReqMsg($reqMsgDTO)         {                                     try             {                 if ($reqMsgDTO == null || $reqMsgDTO->Mid == null || $reqMsgDTO->Mid == ""                 || $reqMsgDTO->OrderId == null || $reqMsgDTO->OrderId == ""                                 )                 {       

What is curl in php

cURL is a library that lets you make HTTP requests in PHP. it is a way you can hit a URL from your code to get a html response from it.  cURL means client URL which allows you to connect with other URLs and use their responses in your code Remark: The curl_exec command in PHP is a bridge to use curl from console.  curl_exec makes it easy to quickly and easily do GET/POST requests,  receive responses from other servers like JSON and download files. Example: $url = 'url_to_post';     $data = array("first_name" => "First name","last_name" => "last name","email"=>" email@gmail. com ","addresses" => array ("address1" => "some address" ,"city" => "city","country" => "CA", "first_name" =>  "Mother","last_name" =>  "Lastnameson","phone" => "555-1212", &quo