Getting Garbage Output When Scraping A Webpage In Php
I am trying to get the contents of a page from Amazon using file_get_html() but the output comes with weird characters on echo. Can anyone please explain how can I resolve this iss
Solution 1:
Here's the solution:
I ran into the same issue when scraping Amazon. Simply add the following option before sending your cURL request:
curl_setopt($handle, CURLOPT_ENCODING, 'gzip,deflate,sdch');
Post a Comment for "Getting Garbage Output When Scraping A Webpage In Php"