Jump to content

Using cURL to Visit a page....


WeirdMystery

Recommended Posts

Hello guys, I am making a page viewer bot. The PHP script will use cURL to visit the site.

 

I've got it working, however, It takes a whole lot of download bandwidth to use it. My question is, when you tell the cURL session to execute and go to the page, is it actually downloading the page server-side? Because I am actually going to make this a public service and I don't want it to waste loads of bandwidth.

 

All I want the script to do is make the site think I've visited the page.

 

<?
    $url = "examplesite.com";
    curl_setopt ($curl, CURLOPT_URL, "$url" );
    curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1 );
    $exec = curl_exec ($curl);
    
    curl_close ($curl);
?>

 

Link to comment
https://forums.phpfreaks.com/topic/199849-using-curl-to-visit-a-page/
Share on other sites

Yes, that will download the entire page. To just get the page headers you can use this:

 

CURLOPT_NOBODY  TRUE to exclude the body from the output. Request method is then set to HEAD. Changing this to FALSE  does not change it to GET.

 

With the curl_setopt to just get the headers.

Yes, that will download the entire page. To just get the page headers you can use this:

 

CURLOPT_NOBODY  TRUE to exclude the body from the output. Request method is then set to HEAD. Changing this to FALSE  does not change it to GET.

 

With the curl_setopt to just get the headers.

 

Thanks man, it took way faster and it took less bandwidth. Thanks again.  :D

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.