[Ask] grab per kata

Discussion in 'Desain Web dan Programming' started by kadal, 13 Mar 2014.

Thread Status:
Not open for further replies.
  1. kadal

    kadal Poster 2.0

    Messages:
    102
    Likes Received:
    5
    Trophy Points:
    18
    halo master semua
    saya mau tanya ni tentang grab per kata

    jadi problemnya begini
    target.akan/digrab.html

    Code:
    $grab =file_get_contents('target.akan/digrab.html');
    echo grab;
    dan hasil yang muncul adalah :
    Code:
    nenek makan nasi kucing disebelah
    pertanyaannya, bisa gak kata dari hasil grab dipisah jadi per kata?

    contohnya :
    Code:
    nenek
    makan
    nasi
    kucing
    disebelah
    salam
     
  2. ceo.ahlul

    ceo.ahlul Expert 1.0 Web Hosting (Company)

    Messages:
    622
    Likes Received:
    255
    Trophy Points:
    63
    Kalau memang di pisah spasi tinggal di pisah saja:

    Misal:

    $hasil = explode(" ",$grab);
    foreach($hasil as $kata) {
    echo $kata;
    }
     
  3. kadal

    kadal Poster 2.0

    Messages:
    102
    Likes Received:
    5
    Trophy Points:
    18
    tak coba dulu kang ahlol..
    thanks..
     
  4. kadal

    kadal Poster 2.0

    Messages:
    102
    Likes Received:
    5
    Trophy Points:
    18
    aduh, ga bisa edit post ya?
    yang diatas udah bisa kang, makasih banyak,

    mau tanya 1 lg boleh gak kang?

    kalau nge grab 1 kata aja gmana ya?
    contoh :
    Code:
    makan
    makasih banyak sebelumnya kang
     
  5. hantuceria

    hantuceria Poster 2.0

    Messages:
    134
    Likes Received:
    7
    Trophy Points:
    18
    Kalo Pake koding diatas, untuk nampilin 1 kata aja, yang ada di array terbawah pake

    echo $hasil[0];
     
  6. kadal

    kadal Poster 2.0

    Messages:
    102
    Likes Received:
    5
    Trophy Points:
    18
    nuhun master
    udah sukses..
     
  7. exabytes-id

    exabytes-id Apprentice 2.0

    Messages:
    593
    Likes Received:
    72
    Trophy Points:
    28
    penggunaan explode menghasilkan data array. Artinya, variable penyimpanya juga berupa array. Misal $hasil_explode[0];
     
  8. hantuceria

    hantuceria Poster 2.0

    Messages:
    134
    Likes Received:
    7
    Trophy Points:
    18
    sipppppp :113:
     
  9. kadal

    kadal Poster 2.0

    Messages:
    102
    Likes Received:
    5
    Trophy Points:
    18
    sore master, mw tanya lg nih, soal grabbing,
    setelah berhasil menampilkan kata perbaris, saya mau menghapus beberapa huruf didepan

    contoh makan ($hasil[0])
    sekarang mw menampilkan makan menjadi akan

    mohon bantuannya master

    thanks
     
  10. ceo.ahlul

    ceo.ahlul Expert 1.0 Web Hosting (Company)

    Messages:
    622
    Likes Received:
    255
    Trophy Points:
    63
    $hasil = substr($hasil[0],1);
     
Loading...
Thread Status:
Not open for further replies.

Share This Page

Loading...