Answer the question
In order to leave comments, you need to log in
How to download all css/js/page images using curl?
Hello. I have the following problem.
It is required using cURL to get the page and display it on your domain. The problem is that the page also has various css, js and pictures files. To be honest, I don’t fully understand how cURL works, but in the developer’s console I see that he tries to load all these additional files, but gets a 404 error, because the paths to these files are relative and cURL takes my domain as the main domain , not the donor site.
Please tell me if there is a solution to this problem and if so, how can it be solved?
Current script code:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://site.com');
//curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_COOKIEJAR, realpath("cookie.txt"));
curl_setopt($ch, CURLOPT_COOKIEFILE, realpath("cookie.txt"));
curl_exec($ch);
curl_close($ch);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question