Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.