private string host = "ftp://ftp.example.com";
private string user = "example.com";
private string pass = "sifre";
private FtpWebResponse ftpResponse = null;
private Stream ftpStream = null;
private int bufferSize = 2048;
private FtpWebRequest FTP=null;

public bool download(string sunucu_yolu, string kayitedilecek_yer)
        {
            if (NetworkKontrol.InternetKontrol())
            {
                try
                {
                    FTP = (FtpWebRequest)WebRequest.Create(host + "/" + sunucu_yolu);
                    FTP.Credentials = new NetworkCredential(user, pass);
                    FTP.UseBinary = true;
                    FTP.UsePassive = true;
                    FTP.KeepAlive = true;
                    FTP.Method = WebRequestMethods.Ftp.DownloadFile;
                    ftpResponse = (FtpWebResponse)FTP.GetResponse();
                    ftpStream = ftpResponse.GetResponseStream();
                    FileStream localFileStream = new FileStream(kayitedilecek_yer, FileMode.Create);
                    byte[] byteBuffer = new byte[bufferSize];
                    int bytesRead = ftpStream.Read(byteBuffer, 0, bufferSize);
                    try
                    {
                        while (bytesRead > 0)
                        {
                            localFileStream.Write(byteBuffer, 0, bytesRead);
                            bytesRead = ftpStream.Read(byteBuffer, 0, bufferSize);
                        }

                        return true;
                    }
                    catch (Exception ex) { MessageBox.Show(ex.Message, "Hata"); }
                    
                    localFileStream.Close();
                    ftpStream.Close();
                    ftpResponse.Close();
                    FTP = null;
                }
                catch (Exception ex) { MessageBox.Show(ex.Message, "Hata"); }
                return false;
            }
            else
                return false;
        }
        
        public bool upload(string dosya_yolu)
        {
            if (NetworkKontrol.InternetKontrol())
            {
                try
                {
                    FileInfo FI = new FileInfo(dosya_yolu);
                    string uri = host + "/" + FI.Name;
                    FTP = (FtpWebRequest)WebRequest.Create(uri);
                    FTP.Credentials = new NetworkCredential(user, pass);
                    FTP.UsePassive = true;
                    FTP.UseBinary = true;
                    FTP.KeepAlive = true;
                    FTP.Method = WebRequestMethods.Ftp.UploadFile;
                    FTP.ContentLength = FI.Length;
                    int buffLength = 2048;
                    byte[] buff = new byte[buffLength];
                    int contentLen;
                    FileStream FS = FI.OpenRead();

                    Stream strm = FTP.GetRequestStream();
                    contentLen = FS.Read(buff, 0, buffLength);
                    while (contentLen != 0)
                    {
                        strm.Write(buff, 0, contentLen);
                        contentLen = FS.Read(buff, 0, buffLength);
                    }
                    strm.Close();
                    FS.Close();
                    return true;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Hata");
                    return false;
                }

            }
            else
                return false;
        }
        
        public bool delete(string deleteFile)
        {
            if (NetworkKontrol.InternetKontrol())
            {
                try
                {
                    FTP = (FtpWebRequest)WebRequest.Create(host + "/" + deleteFile);
                    FTP.Credentials = new NetworkCredential(user, pass);
                    FTP.UseBinary = true;
                    FTP.UsePassive = true;
                    FTP.KeepAlive = true;
                    FTP.Method = WebRequestMethods.Ftp.DeleteFile;
                    ftpResponse = (FtpWebResponse)FTP.GetResponse();
                    ftpResponse.Close();
                    FTP = null;
                    return true;
                }
                catch (Exception ex) { MessageBox.Show(ex.Message, "Hata"); }
                return false;
            }
            else
                return false;
        }

 

using System.ComponentModel;
using System.Windows.Forms;

namespace backgroundWorker_Kullanım
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            Thread.RunWorkerAsync();//BackgroundWorker(Thread)'ı RunWorkerAsync() fonksiyonu ile başlatırız.
        }
        int toplam;
        private void Thread_DoWork(object sender, DoWorkEventArgs e)
        {
            //Arka Planda çalışacak kodlarımız. Dikkat: 
            //Örneğin Veritabanından veri çekiyoruz
            //Çektiğimiz verileri burda Arayüz bulunan Componentlere(Listbox,Combobox,Datagridview vs) aktarmıyoruz
            //Çünkü o Componentlere mainThread' te eriştiği için Çapraz iş parçacığı hatası alırız
            //Bu yüzden verileri Array,DataTable,Hash dizilerine,değiskenlere vs atarız 
            //Örnek:
            for (int i = 0; i < 10; i++)
                toplam +=i;
        }

        private void Thread_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            //Thread_DoWork fonksiyonu çalışıp bittiğinde ardından bu fonksiyon çalışır
            //Burda ise Arayüz Componentlerine veriyi aktardığımız fonksiyondur
            //Örnek
            label.Text = toplam + "";
        }
    }
}

 

GPS Kullanım Tamamını indir

package com.example.ali.gpskullanm;

import android.Manifest;
import android.app.AlertDialog;
import android.content.ContentValues;
import android.content.Context;
import android.content.DialogInterface;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import java.io.BufferedWriter;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {
    LocationListener ll;
    LocationManager lm;
    Context c;
    double enlem, boylam;
    TextView tenlem,tboylam;
    ConnectivityManager cm;
    NetworkInfo networkinfo;
    AlertDialog.Builder dialog;
    int saat=(1000*60*60);
    vt vt_sinfi;
    SQLiteDatabase db;
    Button btn;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        c = this;
        vt_sinfi=new vt(c);
        btn=(Button)findViewById(R.id.btn);
        btn.setOnClickListener(this);

        tenlem=(TextView)findViewById(R.id.enlem);
        tboylam=(TextView)findViewById(R.id.boylam);
        dialogcreate();

    }
    public void dialogcreate()
    {
        dialog=new AlertDialog.Builder(c);
        dialog.setTitle("Konum");
        dialog.setMessage("Konumu Açınız!!");
        dialog.setPositiveButton("Tamam", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {

            }
        });
        dialog.create().show();
    }
    public void init()
    {
        lm=null;
        lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
        ll = new LocationListener() {
            @Override
            public void onLocationChanged(Location location) {
                enlem = location.getLatitude();
                boylam = location.getLongitude();
                tenlem.setText(enlem+"");
                tboylam.setText(boylam+"");
                cm=(ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
                networkinfo=(NetworkInfo) cm.getActiveNetworkInfo();
                if(networkinfo!=null&&networkinfo.isConnected())
                {
                    if(veri_kontrol())
                        sunucuya_ekle();
                    post(enlem+"",boylam+"");
                }
                else
                {
                    konum_ekle(enlem+"",boylam+"");
                    Toast.makeText(c, "Konum veritabnına kayıtedildi", Toast.LENGTH_LONG).show();
                }
                lm.removeUpdates(ll);

            }
            @Override
            public void onStatusChanged(String s, int i, Bundle bundle) {

            }
            @Override
            public void onProviderEnabled(String s) {
                Toast.makeText(c, "GPS Veri bilgileri Alınıyor...", Toast.LENGTH_LONG).show();
            }
            @Override
            public void onProviderDisabled(String s) {
                Toast.makeText(c, "GPS Bağlantı Bekleniyor...", Toast.LENGTH_LONG).show();
            }
        };
        if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
            Toast.makeText(c,"Konum açınız!!!",Toast.LENGTH_LONG).show();
            return;
        }
        if(networkinfo!=null&&networkinfo.isConnected()) {//bağlandı ise tru döndürür
            lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,6000,0, ll);
        }
        else
        {
            lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 6000, 0, ll);
        }
    }
    public  void post(final String enlem, final String boylam)
    {

        new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    URL url = new URL("http://alikomesogutlu.org/yandexmap.php");
                    HttpURLConnection  conn = (HttpURLConnection) url.openConnection();
                    conn.setReadTimeout(10000);
                    conn.setConnectTimeout(15000);
                    conn.setRequestMethod("POST");
                    conn.setDoInput(true);
                    conn.setDoOutput(true);

                    Uri.Builder builder = new Uri.Builder()
                            .appendQueryParameter("enlem",enlem)
                            .appendQueryParameter("boylam", boylam);
                    String query = builder.build().getEncodedQuery();

                    OutputStream os = conn.getOutputStream();//bağlantının cıkısı
                    BufferedWriter writer = new BufferedWriter(
                            new OutputStreamWriter(os, "UTF-8"));
                    writer.write(query);
                    writer.flush();
                    writer.close();
                    os.close();
                    conn.connect();
                    Log.d("hata",conn.getResponseMessage());
                }
                catch (Exception ex)
                {

                }
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {

                        Toast.makeText(c,"Konum sunucuya kayıt edildi.",Toast.LENGTH_SHORT).show();
                    }
                });
            }
        }).start();
    }
    public void baglan()
    {
        try {
            db=vt_sinfi.getWritableDatabase();
        }
        catch (Exception ex)
        {
            Toast.makeText(c,ex.getMessage(),Toast.LENGTH_SHORT).show();
        }
    }
    public void konum_ekle(String enlem,String boylam)
    {
        try {
            baglan();
            ContentValues par=new ContentValues();
            par.put("enlem",enlem);
            par.put("boylam",boylam);
            db.insertOrThrow("konum",null,par);
            db.close();
        }
        catch (Exception ex)
        {
            Toast.makeText(c,ex.getMessage(),Toast.LENGTH_SHORT).show();
        }
    }
    public void sunucuya_ekle()
    {
        try {
            baglan();
            Cursor cursor=db.query("konum",new String[]{"enlem","boylam"},null,null,null,null,null);
            cursor.moveToPosition(-1);
            while (cursor.moveToNext())
                post(cursor.getString(0),cursor.getString(1));
            cursor.close();
            vt_sinfi.onUpgrade(db,0,0);
            db.close();
        }
        catch (Exception ex)
        {
            Toast.makeText(c,ex.getMessage(),Toast.LENGTH_SHORT).show();
        }
    }
    public boolean veri_kontrol()
    {
        try {
            baglan();
            Cursor cursor=db.rawQuery("select * from konum",null);
            if(cursor.getCount()>0)
            {   db.close();
                return true;
            }
            else {
                db.close();
                return false;
            }
        }
        catch (Exception ex)
        {
            Toast.makeText(c,ex.getMessage(),Toast.LENGTH_SHORT).show();
            return false;
        }
    }

    @Override
    public void onClick(View view) {
        init();
    }
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8"/>
<?php
$enlem='36.584014';
$boylam='36.163995'; 
if(isset($_POST['konum']))
{
	$enlem_boylam=explode(",",$_POST['konum']);
	$enlem=$enlem_boylam[0];
	$boylam=$enlem_boylam[1];

}
if(isset($_POST['enlem'])&&isset($_POST['boylam']))
{
$dosya=fopen('konum.txt','a');
fwrite($dosya,$_POST['enlem'].",".$_POST['boylam']."-");
fclose($dosya);
}
else
{
	try{
$dosya=fopen('konum.txt','r');
$boyut=filesize('konum.txt');
$veri=fread($dosya,$boyut);
fclose($dosya);
$konum=explode("-",$veri);

	}
	catch(Exception $ex)
	{
		echo $ex->getMessage();
	}
?>
    <title>YMapsML examples. Map parameters</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	 <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-wp-preserve="%3Cscript%20src%3D%22http%3A%2F%2Fapi-maps.yandex.ru%2F2.0%2F%3Fload%3Dpackage.full%26lang%3Dtr-TR%22%20type%3D%22text%2Fjavascript%22%3E%3C%2Fscript%3E" data-mce-resize="false" data-mce-placeholder="1" class="mce-object" width="20" height="20" alt="<script>" title="<script>" />
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-wp-preserve="%3Cscript%20type%3D%22text%2Fjavascript%22%3E%0D%0Aymaps.ready(init)%3B%0D%0Afunction%20init%20()%20%7B%0D%0A%20%20%20var%20myMap%20%3D%20new%20ymaps.Map('map'%2C%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20center%3A%20%5B%3C%3Fphp%20echo%20%24enlem%3B%3F%3E%2C%20%3C%3Fphp%20echo%20%24boylam%3B%3F%3E%5D%2C%0D%0A%20%20%20%20%20%20%20%20%20%20%20zoom%3A%2012%0D%0A%20%20%20%20%20%20%20%7D)%2C%0D%0A%20%20%20%20%20%20%20myPlacemark%20%3D%20new%20ymaps.Placemark(%5B%3C%3Fphp%20echo%20%24enlem%3B%3F%3E%2C%20%3C%3Fphp%20echo%20%24boylam%3B%3F%3E%5D%2C%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20content%3A%20'%C4%B0skenderun!'%2C%0D%0A%20%20%20%20%20%20%20%20%20%20%20balloonContent%3A%20'Buradas%C4%B1n%C4%B1z!!!!'%0D%0A%20%20%20%20%20%20%20%7D)%3B%0D%0A%20%20%20myMap.controls%0D%0A%20%20%20%20%20%20%20.add('searchControl'%2C%20%7B%20left%3A5%2C%20top%3A%205%20%7D)%0D%0A%20%20%20%20%20%20%20.add('smallZoomControl'%2C%20%7B%20left%3A%205%2C%20top%3A%20165%20%7D)%0D%0A%20%20%20%20%20%20%20.add('typeSelector')%0D%0A%20%20%20%20%20%20%20.add('mapTools'%2C%20%7B%20left%3A%205%2C%20top%3A%20460%20%7D)%0D%0A%20%20%20%20%20%20%20.add('trafficControl'%2C%20%7B%20left%3A%20270%2C%20top%3A%205%20%7D)%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20myMap.geoObjects.add(myPlacemark)%3B%0D%0A%7D%0D%0A%3C%2Fscript%3E" data-mce-resize="false" data-mce-placeholder="1" class="mce-object" width="20" height="20" alt="<script>" title="<script>" />
</head>
<body>
<table>
<tr><td>
<form method="post">
<select name="konum" id="konum" onchange='this.form.submit()' >
<option value="Seçiniz...">Seçiniz...</option> 
<?php
for($i=0;$i<count($konum)-1;$i++){
?>
<option value="<?php echo $konum[$i];?>"><?php echo $konum[$i];?></option> 
<?php }?>
</select>
</form>
</td><td>
<?php 
}
?>
    <div id="map" style="width:640px; height:400px;"></div>
</td>
</tr>
</table>
</body>
</html>

OnlineDBIslemler Tamamını İndir

package com.example.ali.onlinedbkullanim;

import android.content.Context;
import android.content.DialogInterface;
import android.net.Uri;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.Toast;


import org.json.JSONArray;
import org.json.JSONObject;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;

public class MainActivity extends AppCompatActivity implements View.OnClickListener,AdapterView.OnItemClickListener{
    Context c;
    EditText tad,tgun;
    Button btn;
    int[] id;
    String[] ad;
    ListView lv;
    ArrayList<String> liste;
    ArrayAdapter<String> adp;
    AlertDialog.Builder dialog;
    int secilen_id;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        c=this;
        liste=new ArrayList<String>();
        lv=(ListView)findViewById(R.id.list);
        lv.setOnItemClickListener(this);
        adp=new ArrayAdapter<String>(c,android.R.layout.simple_list_item_1,liste);
        lv.setAdapter(adp);
        btn=(Button)findViewById(R.id.btn_ekle);
        btn.setOnClickListener(this);
        tad=(EditText)findViewById(R.id.tad);
        veri_getir();

    }
    public  void post(final Uri.Builder builder)
    {

        new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    URL url = new URL("http://alikomesogutlu.com/db.php");
                    HttpURLConnection conn = (HttpURLConnection) url.openConnection();
                    conn.setReadTimeout(10000);
                    conn.setConnectTimeout(15000);
                    conn.setRequestMethod("POST");
                    conn.setDoInput(true);
                    conn.setDoOutput(true);

                    String query = builder.build().getEncodedQuery();

                    OutputStream os = conn.getOutputStream();//bağlantının cıkısı
                    BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(os, "UTF-8"));
                    writer.write(query);
                    writer.flush();
                    writer.close();
                    os.close();

                }
                catch (Exception ex)
                {
                    Log.d("hata",ex.getMessage());
                }
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        veri_getir();
                    }
                });
            }
        }).start();
    }
public void veri_getir()
{
        new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    URL url = new URL("http://alikomesogutlu.com/db.php");
                    HttpURLConnection conn = (HttpURLConnection) url.openConnection();

                    StringBuilder builder=new StringBuilder();
                    BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(conn.getInputStream()));

                    String json="";

                    while ((json = bufferedReader.readLine()) != null)
                        builder.append(json + "\n");

                    JSONArray jsonArray = new JSONArray(builder.toString().trim());
                     id = new int[jsonArray.length()];
                     ad = new String[jsonArray.length()];

                    for (int i = 0; i < jsonArray.length(); i++) {
                        JSONObject obj = jsonArray.getJSONObject(i);

                        id[i] = obj.getInt("id");
                        ad[i]=obj.getString("ad");
                    }
                }
                catch (Exception ex)
                {
                    Log.d("hata",ex.getMessage());
                }
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                     liste.clear();
                     adp.notifyDataSetChanged();
                    for (int i=0;i<id.length;i++)
                        adp.add(ad[i]);
                    }
                });
            }
        }).start();
}
    @Override
    public void onClick(View view) {
        if(tad.getText().length()>0)
        {
            Uri.Builder builder = new Uri.Builder();//post paremetreleri ayarlanıyor
            builder.appendQueryParameter("ad",tad.getText()+"");
            builder.appendQueryParameter("durum", "0");
            post(builder);
            tad.setText("");
        }

    }
    @Override
    public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
        dialog=new AlertDialog.Builder(c);
        tgun=new EditText(c);
        tgun.setText(liste.get(i));
        secilen_id=id[i];
        dialog.setView(tgun);
        dialog.setTitle("Güncelle/Sil");
        dialog.setPositiveButton("Sil", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                Uri.Builder builder = new Uri.Builder();//post paremetreleri ayarlanıyor
                builder.appendQueryParameter("id",secilen_id+"");
                builder.appendQueryParameter("durum", "1");
                post(builder);
            }
        });
        dialog.setNegativeButton("Güncelle", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                if(tgun.getText().length()>0) {
                    Uri.Builder builder = new Uri.Builder();//post paremetreleri ayarlanıyor
                    builder.appendQueryParameter("ad", tgun.getText() + "");
                    builder.appendQueryParameter("durum", "2");
                    builder.appendQueryParameter("id", secilen_id + "");
                    post(builder);
                }
                else
                    Toast.makeText(c,"Alan Boş bırakılamaz!!",Toast.LENGTH_LONG).show();
            }
        });
        dialog.create().show();
    }
}
<span id="mce_marker" data-mce-type="bookmark" data-mce-fragment="1">​</span>
<?php
 function conn(){
	 try{
	 return	$baglanti=new PDO('mysql:host=localhost;port=3306;dbname=Veritabanı ismi;charset=utf8',"Kulanıcı ismi","Şifre");
	}
	catch(PDOException $ex)
	{
		$ex->getMessage();
	}
 }
 
 function insert($ad)
 {
	 try{
		 $baglanti=conn();
	$sorgu1=$baglanti->prepare("insert into kisiler(ad) values(?)");
    $sorgu1->bindParam(1,$ad);
    $sorgu1->execute();
    $baglanti=null;
	}
	catch(PDOException $ex)
	{
		$ex->getMessage();
	}
 }
 function get_data()
 {
	 try{
		 $baglanti=conn();
	$sorgu=$baglanti->prepare("select * from kisiler order by id desc");
    $sorgu->execute();
	$veri=$sorgu->fetchAll(PDO::FETCH_ASSOC);
    $dizi;
	$sayac=0;
	foreach($veri as $deger)
	{
		$dizi[$sayac++]=['id'=>$deger["id"],'ad'=>$deger["ad"]];
	}
	$baglanti=null;
	echo json_encode($dizi);
	}
	catch(PDOException $ex)
	{
		$ex->getMessage();
	}
 }
  function update($ad,$id)
 {
	 try{
		 $baglanti=conn();
	$sorgu1=$baglanti->prepare("update kisiler set ad=? where id=?");
    $sorgu1->bindParam(1,$ad);
	$sorgu1->bindParam(2,$id);
    $sorgu1->execute();
    $baglanti=null;
	}
	catch(PDOException $ex)
	{
		$ex->getMessage();
	}
 }
  function data_delete($id)
 {
	 try{
		 $baglanti=conn();
	$sorgu1=$baglanti->prepare("delete from kisiler where id=?");
	$sorgu1->bindParam(1,$id);
    $sorgu1->execute();
    $baglanti=null;
	}
	catch(PDOException $ex)
	{
		$ex->getMessage();
	}	 
 }
  if(isset($_POST['ad'])&&isset($_POST['durum'])&&$_POST['durum']=='0')
 {
    insert($_POST['ad']);	 
 }
 else if(isset($_POST['id'])&&isset($_POST['durum'])&&$_POST['durum']=='1')
 {
    data_delete($_POST['id']);
 }
 else if(isset($_POST['ad'])&&isset($_POST['id'])&&isset($_POST['durum'])&&$_POST['durum']=='2')
 {
    update($_POST['ad'],$_POST['id']);
 }
 else{
	get_data();
 }
?>

 

<html>
<head>
    <meta charset="UTF-8">
</head>
<body>
<?php
    function getir($url,$aranan){
        $cekilen_veri = file_get_contents($url);
		//file_get_contents fonksiyonu belirtilen siteyi html halini return eder
        preg_match_all($aranan, $cekilen_veri, $data);
		//preg_match_all fonksiyonu 3 paremetre alır.
		//ilk paremetresi hangi kalıplar arasındaki verilerin alınacağı yer yazılır.
		//ikinci paremetresi ise verinin nerden alınacağı 
		//alınan verinin hangi değişkene atılacağı yazılır
        return $data;
    }

    if(isset($_GET["id"]) && !empty($_GET["id"])){//Eğer id doğru bir sekilde geldi ise içeriğini göster 

        $deger=getir('http://www.iste.edu.tr/duyuru-merkezi/'.$_GET["id"],'@<div class="text-title border border-gray border-only-bottom mb-3">(.*?)</section>@si');
        $deger=trim($deger[1][0])
		 ?>
        <form method="GET" action="http://alikomesogutlu.org/bot.php">
        <input type="submit"  value="GERİ">
        </form>
        <?php

        if(strstr($deger, "TIKLAYIN")){

            $dizi = explode('<div class="text-container">', $deger);
            $dizi2 = explode('<a href="', $dizi[1]);
            $dizi3 = explode('">', $dizi2[1]);

            $deger2=getir($dizi3[0],'@<div class="text-container">(.*?)</div>@si');
           

            for($i=0;$i<count($deger2[1]);$i++){
                echo $deger2[1][$i];
            }
            echo "</div>";

        }
        else{
            $veri=explode('<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">',$deger);
	        echo "<div>".$veri[0];//eğer içerikte link yoksa direk içerik varsa ekrana yazdır    

		}
    }
    else { //gelmedi ise tekrardan duyuruları getir
         if(isset($_POST["kategori"]))         
		 { 
	        $secilen_kategori=$_POST["kategori"];
			$bulunan_kategori="";
			 $kategoriler=["GENEL"=>"genel","ÖĞRENCİ"=>"ogrenci","AKADEMİK"=>"akademik","KAMPÜS"=>"kampus"];
			 foreach($kategoriler as $key=>$kad)
			   if($secilen_kategori==$key)
			   {
				   $bulunan_kategori=$kad;
				   break;
			   } 
			 $deger=getir('http://iste.edu.tr/duyuru-merkezi/'.$bulunan_kategori,'@<article class="border border-gray border-only-bottom mb-3 pb-3">(.*?)</article>@si');
		 }
			 else
			 { 
		 $deger=getir('http://iste.edu.tr/duyuru-merkezi/genel','@<article class="border border-gray border-only-bottom mb-3 pb-3">(.*?)</article>@si');
		//article taglarını çek
			 }
        array_shift($deger[0]);//dizinin 0. indisdeki değerini sil
        ?>

		 <form method="POST" action="">
        <input type="submit"   value="GENEL" name="kategori">
        <input type="submit"  value="ÖĞRENCİ" name="kategori">
        <input type="submit"  value="AKADEMİK" name="kategori">
        <input type="submit"  value="KAMPÜS" name="kategori">
        </form>	
		
	   <ul>
        <?php
        for($a=0;$a<count($deger[0]);$a++){
            $dizi = explode('</b></a></span></span>', $deger[0][$a]);//belirtilen sablona göre patlat
            $dizi2 = explode('<a href="', $dizi[1]);//sonra belirtilen sablona göre bir daha patlat
            $dizi3 = explode('">', $dizi2[1]);
            $dizi4 = explode('</h3>', $dizi3[2]);

            $dizi5 = explode('duyuru-merkezi/',trim($dizi3[0]));//dizi5 te linkler var dizi4 te duyuru baslıkları var
            ?>
            <li><a href="bot.php?id=<?=$dizi5[1]?>"><?=trim($dizi4[0])?></a></li>
            <?php
        }

    }
?>
        </ul>
</body>
</html>

 

package com.example.ali.tabhostkullanm;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TabHost;

public class MainActivity extends AppCompatActivity {
  TabHost tab;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    tab=(TabHost)findViewById(R.id.tab);
    tab.setup();
        TabHost.TabSpec s1=tab.newTabSpec("Sayfa-1");//yeni segmeler olusturuluyor
        TabHost.TabSpec s2=tab.newTabSpec("Sayfa-2");
        TabHost.TabSpec s3=tab.newTabSpec("Sayfa-3");

        s1.setContent(R.id.tab1);//her tabın Linearlayoutu ayarlanıyor
        s2.setContent(R.id.tab2);
        s3.setContent(R.id.tab3);
        s1.setIndicator("Sayfa-1");//gösterge ayarlanıyor
        s2.setIndicator("Sayfa-2");
        s3.setIndicator("Sayfa-2");
        tab.addTab(s1);//sayfalar tabhosta ekleniyor
        tab.addTab(s2);
        tab.addTab(s3);
    }
}
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <TabHost
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/tab"
        >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <TabWidget
                android:id="@android:id/tabs"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />

            <FrameLayout
                android:id="@android:id/tabcontent"
                android:layout_width="match_parent"
                android:layout_height="match_parent">

                <LinearLayout
                    android:id="@+id/tab1"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:orientation="vertical">
                  <!-- 1.Sayfa layout'u-->
                </LinearLayout>

                <LinearLayout
                    android:id="@+id/tab2"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:orientation="vertical">
                    <!-- 2.Sayfa layout'u-->
                </LinearLayout>

                <LinearLayout
                    android:id="@+id/tab3"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:orientation="vertical">
                    <Button
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content" />
                    <!-- 3.Sayfa layout'u-->
                </LinearLayout>

            </FrameLayout>
        </LinearLayout>
    </TabHost>
</android.support.constraint.ConstraintLayout>

 

Hepsini indir

package com.example.ali.myapplication;


import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;


import com.example.ali.myapplication.fragment1.form;

public class MainActivity extends AppCompatActivity implements View.OnClickListener{

  RelativeLayout rl;
  LinearLayout ll;
  Fragment frg;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        PageCreate();
    }

    public void PageCreate()
    {
        rl=(RelativeLayout)findViewById(R.id.cerceve);//layoutu alıyoruz cünkü icersisine ekleme yapmak için
        ll=new LinearLayout(this);
        ll.setOrientation(LinearLayout.VERTICAL);
        ViewGroup.LayoutParams lp=new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        ll.setLayoutParams(lp);//genislik ve yükseklik ayarlandi
            Button btn=new Button(this);
            btn.setText("fragment'e geçis");
            int id=1;
            btn.setId(id);
            btn.setOnClickListener(this);
            ll.addView(btn);
            rl.addView(ll);
    }

    @Override
    public void onClick(View view) {
       frg=new form();
        FragmentManager fm=getSupportFragmentManager();//fragment yöneticisi
        FragmentTransaction ft=fm.beginTransaction();//transaction islemi basladı
        ft.replace(rl.getId(),frg);//layoutlar yer degistirdi
        ft.commit();//
    }

}
package com.example.ali.myapplication.fragment1;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

import com.example.ali.myapplication.R;

/**
 * A simple {@link Fragment} subclass.
 */
public class form extends Fragment  {
  Button btn;
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
      final Fragment fgm=this;
      View view=inflater.inflate(R.layout.fragment_form,container,false);//view 'e esitledik componentleri baglamak için
      btn=(Button)view.findViewById(R.id.btn);
      btn.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              getFragmentManager().beginTransaction().remove(fgm).commit();//fragment silindi ve onaylandı
          }
      });
      return view;
    }


}