PHP API :
Saturday, 9 December 2023
CRUD opration using PHP API & DOT NET MVC
PHP API :
Tuesday, 5 December 2023
CRUD opration using PHP API & DOT NET MVC
PHP API :
DOT NET MVC:
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Security.Policy;
using System.Text;
using System.Web;
using System.Web.Mvc;
using WebApplication9.Models;
using System.Threading.Tasks;
namespace WebApplication9.Controllers
{
public class ClassController : Controller
{
// GET: Class
public async Task<ActionResult> Index()
{
List<ClassVM> result = new List<ClassVM>();
using (var client = new HttpClient())
{
using (var response = await client.GetAsync("http://localhost:8080/CMS/API/Test"))
{
if (response.IsSuccessStatusCode)
{
var productJsonString = await response.Content.ReadAsStringAsync();
result = JsonConvert.DeserializeObject<ClassVM[]>(productJsonString).ToList();
}
}
}
return View(result);
}
[HttpGet]
public ActionResult Create()
{
ClassVM cvm = new ClassVM();
return View(cvm);
}
[HttpPost]
public async Task<ActionResult> Create(ClassVM vm)
{
using (var client = new HttpClient())
{
var serializedProduct = JsonConvert.SerializeObject(vm);
var content = new StringContent(serializedProduct, Encoding.UTF8, "application/json");
var result = await client.PostAsync("http://localhost:8080/CMS/API/Test", content);
}
return RedirectToAction("Index");
}
[HttpGet]
public async Task<ActionResult> Edit(int id)
{
ClassVM result = new ClassVM();
using (var client = new HttpClient())
{
using (var response = await client.GetAsync("http://localhost:8080/CMS/API/Test?CID="+id))
{
if (response.IsSuccessStatusCode)
{
var productJsonString = await response.Content.ReadAsStringAsync();
result = JsonConvert.DeserializeObject<ClassVM>(productJsonString);
}
}
}
return View(result);
}
[HttpPost]
public async Task<ActionResult> Edit(ClassVM vm)
{
using (var client = new HttpClient())
{
var serializedProduct = JsonConvert.SerializeObject(vm);
var content = new StringContent(serializedProduct, Encoding.UTF8, "application/json");
var result = await client.PutAsync("http://localhost:8080/CMS/API/Test", content);
}
return RedirectToAction("Index");
}
[HttpGet]
public async Task<ActionResult> Delete(int id)
{
using (var client = new HttpClient())
{
var result = await client.DeleteAsync("http://localhost:8080/CMS/API/Test?CID="+id);
}
return RedirectToAction("Index");
}
}
}
Wednesday, 20 September 2023
HOW TO CREATE ORIYA PAGE IN HTML
<?php include 'Header.php'; ?>
<div class="container" style="padding-top:5px">
Wednesday, 23 August 2023
API IN PHP
<?php
Thursday, 17 August 2023
how to implement payment gateway
<html>
<button id="rzp-button1" class="btn btn-outline-dark btn-lg"><i class="fas fa-money-bill"></i> Own Checkout</button>
<script src="https://checkout.razorpay.com/v1/checkout.js"></script>
<script>
var options = {
"key": "Enter Your Key", // Enter the Key ID generated from the Dashboard
"amount": "1000",
"currency": "INR",
"description": "Acme Corp",
"image": "https://s3.amazonaws.com/rzp-mobile/images/rzp.jpg",
"prefill":
{
"email": "gaurav.kumar@example.com",
"contact": +919900000000,
},
config: {
display: {
blocks: {
banks: {
name: 'Pay using Axis banks',
instruments: [
{
method: 'netbanking',
banks: ['UTIB'],
},
{
method: 'card',
issuers: ['UTIB'],
},
{
method: 'wallet',
wallets:['payzapp']
}
],
},
},
sequence: ['block.banks'],
preferences: {
show_default_blocks: true,
},
},
},
"handler": function (response) {
alert(response.razorpay_payment_id);
},
"modal": {
"ondismiss": function () {
if (confirm("Are you sure, you want to close the form?")) {
txt = "You pressed OK!";
console.log("Checkout form closed by the user");
} else {
txt = "You pressed Cancel!";
console.log("Complete the Payment")
}
}
}
};
var rzp1 = new Razorpay(options);
document.getElementById('rzp-button1').onclick = function (e) {
rzp1.open();
e.preventDefault();
}
</script>
</html>
Monday, 14 August 2023
how to send mail in php
<?php
include 'Header.php';
if(isset($_POST["SubmitBtn"])){
$message ="Name = ". $_POST["name"] . "\r\n Mobile Number = " . $_POST["mobile"] . "\r\n Email id ="
.$_POST["email"]."\r\n".$_POST["msg"];
$subject ="Feedback from JBS";
$fromname ="JBSTECHNOSOFT";
$fromemail = 'noreply@codeconia.com'; //if u dont have an email create one on your cpanel
$mailto = 'chinmayaparijabanglore@gmail.com'; //the email which u want to recv this email
// a random hash will be necessary to send mixed content
$separator = md5(time());
// carriage return type (RFC)
$eol = "\r\n";
// main header (multipart mandatory)
$headers = "From: ".$fromname." <".$fromemail.">" . $eol;
$headers .= "MIME-Version: 1.0" . $eol;
$headers .= "Content-Type: multipart/mixed; boundary=\"" . $separator . "\"" . $eol;
$headers .= "Content-Transfer-Encoding: 7bit" . $eol;
$headers .= "This is a MIME encoded message." . $eol;
// message
$body = "--" . $separator . $eol;
$body .= "Content-Type: text/plain; charset=\"iso-8859-1\"" . $eol;
$body .= "Content-Transfer-Encoding: 8bit" . $eol;
$body .= $message . $eol;
// attachment
$body .= "--" . $separator . $eol;
$body .= "Content-Transfer-Encoding: base64" . $eol;
$body .= "Content-Disposition: attachment" . $eol;
$body .= "--" . $separator . "--";
//SEND Mail
if (mail($mailto, $subject, $body, $headers)) {
echo ""; // do what you want after sending the email
} else {
echo "mail send ... ERROR!";
print_r( error_get_last() );
}
}
?>
<div class="container" style="padding-top:5px">
<div class="well well-lg" style="text-align:left">
<div class="panel panel-primary">
<div class="panel-heading">Feedback</div>
<div class="panel-body">
<form id="emailForm" name="emailForm" method="post" action="Feedback">
<div class="row form-group">
<div class="col-md-3 col-sm-3 col-lg-3 col-xl-3">Enter Your Name</div>
<div class="col-md-1 col-sm-1 col-lg-1 col-xl-1"><b> </b></div>
<div class="col-md-6 col-sm-6 col-lg-6 col-xl-6">
<input type="text" id="name" name="name" class="form-control" required>
</div>
<div class="col-md-2 col-sm-2 col-lg-2 col-xl-2">
</div>
</div>
<div class="row form-group">
<div class="col-md-3 col-sm-3 col-lg-3 col-xl-3">Enter Your Mobile Number</div>
<div class="col-md-1 col-sm-1 col-lg-1 col-xl-1"><b> </b></div>
<div class="col-md-6 col-sm-6 col-lg-6 col-xl-6">
<input type="text" id="mobile" name="mobile" class="form-control" required>
</div>
<div class="col-md-2 col-sm-2 col-lg-2 col-xl-2">
</div>
</div>
<div class="row form-group">
<div class="col-md-3 col-sm-3 col-lg-3 col-xl-3">Enter Your Email Id</div>
<div class="col-md-1 col-sm-1 col-lg-1 col-xl-1"><b> </b></div>
<div class="col-md-6 col-sm-6 col-lg-6 col-xl-6">
<input type="text" id="email" name="email" class="form-control" required>
</div>
<div class="col-md-2 col-sm-2 col-lg-2 col-xl-2">
</div>
</div>
<div class="row form-group">
<div class="col-md-3 col-sm-3 col-lg-3 col-xl-3">Enter Your Feedback</div>
<div class="col-md-1 col-sm-1 col-lg-1 col-xl-1"><b> </b></div>
<div class="col-md-6 col-sm-6 col-lg-6 col-xl-6">
<textarea id="msg" name="msg" rows="10" class="form-control" required></textarea>
</div>
<div class="col-md-2 col-sm-2 col-lg-2 col-xl-2">
</div>
</div>
<div class="row form-group">
<div class="col-md-4 col-sm-4 col-lg-4 col-xl-4"></div>
<div class="col-md-8 col-sm-8 col-lg-8 col-xl-8">
<input type="submit" value="Submit" id="SubmitBtn" name="SubmitBtn" class="btn btn-primary">
<input type="reset" value="Reset" class="btn btn-primary">
</div>
</div>
</from>
</div>
</div>
</div>
</div><br>
<?php include 'Footer.php'; ?>