<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>bludart api Archives - Cody Paste</title>
	<atom:link href="https://www.codypaste.com/tag/bludart-api/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.codypaste.com/tag/bludart-api/</link>
	<description>THE WEB PLAYGROUND</description>
	<lastBuildDate>Tue, 03 Jan 2023 04:27:32 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9</generator>

<image>
	<url>https://www.codypaste.com/wp-content/uploads/2022/12/cropped-codypaste-32x32.png</url>
	<title>bludart api Archives - Cody Paste</title>
	<link>https://www.codypaste.com/tag/bludart-api/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>BlueDart Courier API Integration in PHP CodeIgniter</title>
		<link>https://www.codypaste.com/bluedart-courier-api-integration-in-php-codeigniter/</link>
					<comments>https://www.codypaste.com/bluedart-courier-api-integration-in-php-codeigniter/?noamp=mobile#respond</comments>
		
		<dc:creator><![CDATA[Admin]]></dc:creator>
		<pubDate>Mon, 02 Jan 2023 10:27:44 +0000</pubDate>
				<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[bludart api]]></category>
		<category><![CDATA[bluedart courier]]></category>
		<category><![CDATA[bluedart waybill]]></category>
		<category><![CDATA[waybill]]></category>
		<category><![CDATA[waybill api]]></category>
		<guid isPermaLink="false">https://www.codypaste.com/?p=840</guid>

					<description><![CDATA[<p>Here we will see how to integrate Bluedart Courier API so we can send products to our customers and pick products from the customer. we will Generate BlueDart WayBill also. In this tutorial, we are using CodeIgniter. NOTE: It&#8217;s SOAP base API so never forget to extend it&#8217;s class in php, e.g. class DebugSoapClient extends &#8230; </p>
<p class="link-more"><a href="https://www.codypaste.com/bluedart-courier-api-integration-in-php-codeigniter/" class="more-link">read more<span class="screen-reader-text"> "BlueDart Courier API Integration in PHP CodeIgniter"</span></a></p>
<p>The post <a href="https://www.codypaste.com/bluedart-courier-api-integration-in-php-codeigniter/">BlueDart Courier API Integration in PHP CodeIgniter</a> appeared first on <a href="https://www.codypaste.com">Cody Paste</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Here we will see how to integrate Bluedart Courier API so we can send products to our customers and pick products from the customer.</p>
<p>we will Generate BlueDart WayBill also. In this tutorial, we are using CodeIgniter.</p>
<p><strong>NOTE: It&#8217;s SOAP base API so never forget to extend it&#8217;s class in php, e.g.</strong><br />
<strong><span style="font-size: 1rem;"><span style="color: #ff9900;">class DebugSoapClient extends SoapClient.</span><br />
</span></strong><strong>this class is added in the given controller code.</strong></p>
<p>&nbsp;</p>
<p><strong>STEP 1:</strong></p>
<p>Create a file in  application/controllers/Bluedart.php and put the given code below.</p><pre class="urvanov-syntax-highlighter-plain-tag">&lt;?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Bluedart extends CI_Controller {

	public function __construct(){
	    error_reporting(0);
        parent::__construct();
        $this-&gt;load-&gt;library(array('form_validation','session','cart'));
		//$this-&gt;load-&gt;database();
    }

	
	public function index(){
	    $ordernumber		 = 'ORDER1234'; // Unique Order ID
		$ActualWeight        = '0.5'; //kgs
		$CommodityDetail1    = 'CodyPaste T-shirt'; //Product Name
		$DeclaredValue       = '2000'; //Price

		$Breadth             = '14.1'; //in cms (centimeter)
		$Count               = '1'; // Number of products
		$Height              = '5.1'; //in cms (centimeter)
		$Length              = '32.8'; //in cms (centimeter)

		$CustomerAddress1 = '401, Living Homes';
		$CustomerAddress2 = 'Frineds Enclave';
		$CustomerAddress3 = 'Noida';

		$SpecialInstruction = 'N/A';

		$PickupDate = '2023-01-02'; // YY-MM-DD

		$CustomerEmailID = 'customer@email.com';
		$CustomerMobile = '9989898989';
		$CustomerName = 'Vipul Rai';
		$CustomerPincode = '201009';
		$ProductCode = 'D'; // D: Domestic, A: Air Apex, E: Express/surface
		
					   
		#echo "Start  of Soap 1.2 version (ws_http_Binding)  setting";
		$soap = new DebugSoapClient('https://netconnect.bluedart.com/Ver1.10/ShippingAPI/WayBill/WayBillGeneration.svc?wsdl',
						
		array(
			'trace' 		=&gt; 1,  
			'style'			=&gt; SOAP_DOCUMENT,
			'use'			=&gt; SOAP_LITERAL,
			'soap_version' 	=&gt; SOAP_1_2
		));
						
		$soap-&gt;__setLocation("https://netconnect.bluedart.com/Ver1.10/ShippingAPI/WayBill/WayBillGeneration.svc");

		$soap-&gt;sendRequest = true;
		$soap-&gt;printRequest = false;
		$soap-&gt;formatXML = true; 

		$actionHeader = new SoapHeader('http://www.w3.org/2005/08/addressing','Action','http://tempuri.org/IWayBillGeneration/GenerateWayBill',true);
		$soap-&gt;__setSoapHeaders($actionHeader);	
		#echo "end of Soap 1.2 version (WSHttpBinding)  setting";
					
					
	$params = array(
	'Request' =&gt; 
	array (
	'Consignee' =&gt;
		array (
			'ConsigneeAddress1' 	=&gt; 'Plot 23-24',
			'ConsigneeAddress2' 	=&gt; 'Greno West',
			'ConsigneeAddress3'		=&gt; 'Noida',
			'ConsigneeAttention'	=&gt; 'A',
			'ConsigneeMobile'		=&gt; '9999999999',
			'ConsigneeName'			=&gt; 'Cody Paste',
			'ConsigneePincode'		=&gt; '201009',
			'ConsigneeTelephone'	=&gt; '9999999999',
		),
	'Services' =&gt; 
		array (
			'ActualWeight' 		=&gt; $ActualWeight,
			'CollectableAmount' =&gt; '0',
			'Commodity' =&gt;
				array (
					'CommodityDetail1' =&gt; $CommodityDetail1
			),
			'CreditReferenceNo' =&gt; $ordernumber,
			'DeclaredValue' 	=&gt; $DeclaredValue,
			'Dimensions' =&gt;
				array (
					'Dimension' =&gt;
						array (
							'Breadth' =&gt; $Breadth,
							'Count' =&gt; $Count,
							'Height' =&gt; $Height,
							'Length' =&gt; $Length
						),
				),
				'RegisterPickup' 	=&gt; true, 
				'InvoiceNo' 		=&gt; substr(str_replace("-", "", $ordernumber), -10),
				'PackType' 			=&gt; '',
				'PickupDate' 		=&gt; $PickupDate,
				'PickupTime' 		=&gt; '1800',
				'PieceCount' 		=&gt; '1',
				'ProductCode' 		=&gt; $ProductCode,
				'ProductType' 		=&gt; 'Dutiables',
				'SpecialInstruction' =&gt; $SpecialInstruction,
				'SubProductCode' 	=&gt; ''
		),
		'Shipper' =&gt;
			array(
				'CustomerAddress1' 	=&gt; $CustomerAddress1,
				'CustomerAddress2' 	=&gt; $CustomerAddress2,
				'CustomerAddress3' 	=&gt; $CustomerAddress3,
				'CustomerCode' 		=&gt; '123456', // BlueDart will share Customer Code
				'CustomerEmailID' 	=&gt; $CustomerEmailID,
				'CustomerMobile' 	=&gt; $CustomerMobile,
				'CustomerName'      =&gt; $CustomerName,
				'CustomerPincode'   =&gt; $CustomerPincode,
				'CustomerTelephone' =&gt; $CustomerMobile,
				'IsToPayCustomer'   =&gt; true, // IsToPayCustomer if blank menas 'forward', if 'true' then it's reverse pickup.
				'OriginArea' 		=&gt; 'DEL',
				'Sender' 			=&gt; $CustomerName,
				'VendorCode' 		=&gt; ''
			)
	),
	'Profile' =&gt; 
		array(
			'Api_type' 	=&gt;'S',
			'LicenceKey'=&gt;'XXXXkjhgkjhgjkhg87658765jkhg', // BlueDart will share
			'LoginID'	=&gt;'MOZ1234', // BlueDart will share
			'Version'	=&gt;'1.3'
		)
	);
	// Here I call my external function
	$result = $soap-&gt;__soapCall('GenerateWayBill',array($params));

	$blueDartResponse = $this-&gt;Bluedartmodel-&gt;blueDartResponse($result);
	
	if($blueDartResponse=="1"){
		//Generate Waybill PDF
		$x 					= $result-&gt;GenerateWayBillResult;
		$AWBPrintContent    = $x-&gt;AWBPrintContent;		
        if($AWBPrintContent==""){$AWBPrintContent="none";}
		?&gt;
		  &lt;object data="data:application/pdf;base64,&lt;?php echo base64_encode($AWBPrintContent); ?&gt;" type="application/pdf" style="height:100%;width:100%"&gt;&lt;/object&gt;
		&lt;?php
	}
	
	}
	
}



class DebugSoapClient extends SoapClient {
  public $sendRequest = true;
  public $printRequest = true;
  public $formatXML = true;

  public function __doRequest($request, $location, $action, $version, $one_way=0) {
    if ( $this-&gt;printRequest ) {
      if ( !$this-&gt;formatXML ) {
        $out = $request;
      }
      else {
        $doc = new DOMDocument;
        $doc-&gt;preserveWhiteSpace = false;
        $doc-&gt;loadxml($request);
        $doc-&gt;formatOutput = true;
        $out = $doc-&gt;savexml();
      }
      echo $out;
    }

    if ( $this-&gt;sendRequest ) {
      return parent::__doRequest($request, $location, $action, $version, $one_way);
    }
    else {
      return '';
    }
  }
}</pre><p><strong>CHANGE / UPDATE these fields with real values, which you will get from BlueDart:</strong></p><pre class="urvanov-syntax-highlighter-plain-tag">'Profile' =&gt; 
		array(
			'Api_type' 	=&gt;'S',
			'LicenceKey'=&gt;'XXXXkjhgkjhgjkhg87658765jkhg', // BlueDart will share
			'LoginID'	=&gt;'MOZ1234', // BlueDart will share
			'Version'	=&gt;'1.3'
		)
);</pre><p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><strong>STEP 2:</strong></p>
<p>In Above Controller we are using MODEL &#8216;blueDartResponse()&#8217; to save vluedart response to Database table, so we have to create a &#8216;model&#8217; file here.</p>
<p>Create a file in  application/models/Bluedartmodel.php and put the given code below.</p><pre class="urvanov-syntax-highlighter-plain-tag">&lt;?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Bluedartmodel extends CI_Model {
    public function __construct(){
		$this-&gt;load-&gt;library('session');
		$this-&gt;load-&gt;library('email');
        $this-&gt;load-&gt;database();
    }
   
   public function blueDartResponse($result){
       date_default_timezone_set("Asia/Kolkata"); 
        $x = $result-&gt;GenerateWayBillResult;
        //$y = $x-&gt;AWBPrintContent;
                
        $AWBNo                          = $x-&gt;AWBNo;
        if($AWBNo==""){$AWBNo="none";}
        $AWBPrintContent                = $x-&gt;AWBPrintContent;
        if($AWBPrintContent==""){$AWBPrintContent="none";}
        $AvailableAmountForBooking      = $x-&gt;AvailableAmountForBooking;
        if($AvailableAmountForBooking==""){$AvailableAmountForBooking="none";}
        $AvailableBalance               = $x-&gt;AvailableBalance;
        if($AvailableBalance==""){$AvailableBalance="none";}
        $CCRCRDREF                      = $x-&gt;CCRCRDREF;
        if($CCRCRDREF==""){$CCRCRDREF="none";}
        $DestinationArea                = $x-&gt;DestinationArea;
        if($DestinationArea==""){$DestinationArea="none";}
        $DestinationLocation            = $x-&gt;DestinationLocation;
        if($DestinationLocation==""){$DestinationLocation="none";}
        $IsError                        = $x-&gt;IsError;
        if($IsError==""){$IsError="none";}
        $IsErrorInPU                    = $x-&gt;IsErrorInPU;
        if($IsErrorInPU==""){$IsErrorInPU="none";}
        $ShipmentPickupDate             = $x-&gt;ShipmentPickupDate;
        if($ShipmentPickupDate==""){$ShipmentPickupDate="none";}
        
        $Status_WayBill_StatusCode      = $x-&gt;Status-&gt;WayBillGenerationStatus-&gt;StatusCode;
        if($Status_WayBill_StatusCode==""){$Status_WayBill_StatusCode="none";}
        $Status_Pickup_StatusCode       = $x-&gt;Status-&gt;WayBillGenerationStatus-&gt;StatusInformation;
        if($Status_Pickup_StatusCode==""){$Status_Pickup_StatusCode="none";}
        $TokenNumber                    = $x-&gt;TokenNumber;
        if($TokenNumber==""){$TokenNumber="none";}
        $TransactionAmount              = $x-&gt;TransactionAmount;
        if($TransactionAmount==""){$TransactionAmount="none";}
        $rmanumber                      = $CCRCRDREF;
        if($rmanumber==""){$rmanumber="none";}
        $date                           = date("Y-m-d H:i:sA");
        $status                         = '1';
        
        $datas = array(
    		'AWBNo'                         =&gt; $AWBNo,
    		'AWBPrintContent'               =&gt; $AWBPrintContent,
    		'AvailableAmountForBooking'     =&gt; $AvailableAmountForBooking,
    		'AvailableBalance'              =&gt; $AvailableBalance,
    		'CCRCRDREF'                     =&gt; $CCRCRDREF,
    		'DestinationArea'               =&gt; $DestinationArea,
    		'DestinationLocation'           =&gt; $DestinationLocation,
    		'IsError'                       =&gt; $IsError,
    		'IsErrorInPU'                   =&gt; $IsErrorInPU,
    		'ShipmentPickupDate'            =&gt; $ShipmentPickupDate,
    		'Status_WayBill_StatusCode'     =&gt; $Status_WayBill_StatusCode,
    		'Status_Pickup_StatusCode'      =&gt; $Status_Pickup_StatusCode,
    		'TokenNumber'                   =&gt; $TokenNumber,
    		'TransactionAmount'             =&gt; $TransactionAmount,
    		'rmanumber'                     =&gt; $rmanumber,
    		'date'                          =&gt; $date,
    		'status'                        =&gt; $status,
    		'full_result'                   =&gt; serialize($result)
        );
        if($this-&gt;db-&gt;insert('bluedart_response',$datas)){
            return 1;
        }
       
        
       
   }


}</pre><p><span style="font-size: 24pt;"><a href="https://github.com/vipulrai/Bluedart-Shipping-API-in-PHP-CodeIgniter" target="_blank" rel="noopener"><strong><span style="color: #008000;">Download Files From GitHub</span></strong></a></span></p>
<p>The post <a href="https://www.codypaste.com/bluedart-courier-api-integration-in-php-codeigniter/">BlueDart Courier API Integration in PHP CodeIgniter</a> appeared first on <a href="https://www.codypaste.com">Cody Paste</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.codypaste.com/bluedart-courier-api-integration-in-php-codeigniter/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
