Kali ini data yang didapat hasil eksekusi perintah wget, kalo anda pake curl solusinya ada di Karakter Aneh di cURL PHP. Contoh data sampah yang di dapat ada di bawah ini
data sampah dari wget

Bila sebelumnya anda menggunakan wget dengan format

wget -O a.html http://[DOMAIN.NYA]/

ganti menjadi

wget -O a.html http://[DOMAIN.NYA]/; gunzip -c a.html > b.html

atau lebih singkat

wget -O- http://[DOMAIN.NYA]/ | gunzip -c > a.html

hasilnya lebih manusiawi dan bisa diolah ke tahap selanjutnya
halaman bank bukopin

Tambahan :
Untuk debugging tambahkan -S di wget

$ wget -S http://[DOMAIN.NYA]/
--2015-11-13 16:53:18--  http://[DOMAIN.NYA]/
Resolving www.xxxxxx.co.id (www.xxxxxx.co.id)... 202.xxxx.xxxx, 110.xxxxx
Connecting to www.xxxxxx.co.id (www.xxxxxx.co.id)|202.xxxxxxx|:80... connected.
HTTP request sent, awaiting response... 
  HTTP/1.1 200 OK
  Date: Fri, 13 Nov 2015 09:53:19 GMT
  Server: Apache
  X-Powered-By: PHP/5.2.6
  Content-Type: text/html; charset=utf-8
  Content-Length: 3981
  Connection: Keep-Alive
  Content-Encoding: gzip
  Set-Cookie: session=9c933be317e1e4818b144dfca8709d37; path=/
Length: 3981 (3.9K) [text/html]
Saving to: ‘index.html’

index.html.1                              100%[=====================================================================================>]   3.89K  --.-KB/s   in 0.004s 

2015-11-13 16:53:18 (1.06 MB/s) - ‘index.html’ saved [3981/3981]

lihat di baris 13 Content-Encoding: gzip file hasil download wget diatas di kompress dengan gzip, makanya kita gunakan perintah gunzip untuk mengembalikan filenya ke bentuk semula

Leave a comment

Your email address will not be published. Required fields are marked *