02/26/18

Contoh Coding : Konek ke MSSQL dari php

Berikut Contoh Coding : Konek ke MSSQL dari php

<?php
$conn = new COM ("ADODB.Connection") or die("Cannot Start Ado");
$connStr='PROVIDER=SQLOLEDB;SERVER=localhost;UID=sa;PWD=passwordq;DATABASE=userku';
$conn->open($connStr);

$sSQL = "select * from userku.dbo.daftarUser ";

$rs4=$conn->execute($sSQL);

while(!$rs4->EOF)
{
    echo (trim($rs4['nama']);
    $rs4->MoveNext();
}
?>

Update Riwayat Pendidikan Mahasiswa WebService 2.1 Forlap - PDDIKTI

Berikut adalah cara melakukan edit Riwayat Pendidikan Mahasiswa Web Service 2.1 Forlap PDDIKTI

<?php
$url = 'http://......./ws/live2.php';

$ch = curl_init();

$headers = array();

$headers[]='Content-Type: application/json';

curl_setopt($ch,CURLOPT_HTTPHEADER,$headers);

$username='user PT';
$password = 'password PT';

$data=array('act'=>'GetToken','username'=>$username, 'password'=>$password);

$data=json_encode($data);
curl_setopt($ch,CURLOPT_POSTFIELDS,$data);

curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
$result = curl_exec($ch);
$data=json_decode($result);
$token= $data->data->token;


$ch2 = curl_init();

  curl_setopt($ch2,CURLOPT_HTTPHEADER,$headers);

  $recordPT = array();
  $recordPT['id_jalur_daftar'] = "2"; //untuk merubah id jalur daftar 2-SNMPTN

  $recordKey = array();
  $recordKey['id_registrasi_mahasiswa'] = "diisi-id_reg_pd / id_registrasi_mahasiswa";

  $data=array('act'=>'UpdateRiwayatPendidikanMahasiswa','token'=>$token,'key'=>$recordKey,'record'=>$recordPT);

  $data=json_encode($data) ;
  curl_setopt($ch2,CURLOPT_POSTFIELDS,$data);

  curl_setopt($ch2,CURLOPT_URL,$url);
  curl_setopt($ch2,CURLOPT_RETURNTRANSFER,1);
  $result = curl_exec($ch2);
  echo $result;
?>


ini hanya share saja
demikian, terima kasih

(menerima project webservice forlap pddikti 2.1 call me admin@sunarto.web.id)

Postingan Lebih Baru Postingan Lama