curl - Get HTTP response body content from site for parsing with PHP
one text
I know there are lots of articles on how to get response with Curl and then decode it but non of them worked. Sending request with CURL. Getting response. Dumping response content on the screen shows only "String(996)". I guess its compressed string. Tried to decompress it but didnt work.
Here is my case if someone can help me with that.
I tried this code with different url and it worked.
<?php
//set up variables
$url = 'https://en.bidfax.info';
$response = get_web_page($url);
var_dump ($response);
function get_web_page($url) {
$options = array(
CURLOPT_RETURNTRANSFER => true, // return web page
CURLOPT_HEADER => false, // don't return headers
CURLOPT_FOLLOWLOCATION => true, // follow redirects
CURLOPT_ENCODING => "", // handle all encodings
CURLOPT_AUTOREFERER => true, // set referer on redirect
CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect
CURLOPT_TIMEOUT => 120, // timeout on response
CURLOPT_MAXREDIRS => 10, // stop after 10 redirects
CURLOPT_SSL_VERIFYPEER => false // Disabled SSL Cert checks
);
$ch = curl_init($url);
curl_setopt_array($ch, $options);
$content = curl_exec($ch);
curl_close($ch);
return $content;
}
Went through all posts about curl and gzdecode / encode.
Source