I wrote this script
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $address);
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, TRUE);
curl_setopt($ch, CURLINFO_HEADER_OUT, TRUE);
curl_setopt($ch, CURLOPT_NOBODY, FALSE);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_COOKIEJAR,$cookieFileLocation);
curl_setopt($ch, CURLOPT_COOKIEFILE,$cookieFileLocation);
curl_setopt($ch, CURLOPT_ENCODING, 'gzip,deflate');
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_TIMEOUT, 25);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
$response = curl_exec($ch);
echo ($response);
curl_close($ch);
When I execute the script the site will be loaded but also some other get requests are sent by the browser. How can I stop the browser sending more get requests?
I want to follow the requests I write so I can see which request loads which part of the site. First I just want to see what gets loaded when I send the request I wrote.
I’m guessing you’re trying to do some sort of proxy, using curl to fetch some other html page, and then forward it onto the browser? You will have to rewrite the HTML and CSS and JS in that page so that all requests for other resources (images, fonts, flash, etc…) point back at your server and your proxy script. Otherwise, if the HTML you’re forwarding contains any absolute (and/or
<base>‘d) addresses, you will not be able to prevent the browser from reaching out and fetching those resources directly.