I am trying to write a quick script to log into my host's control panel and set up e-mail addresses when required. The problem is that the control panel checks if the browser has cookies enabled, and if it doesn't, doesn't even send the login, just displays a "You must have cookies enabled" generic message.

Is there a flag for cURL that can make the page believe it has cookies enabled and send the cookies properly?

    The problem is not getting the cookies themselves; I have a custom regex to grab the cookies from the headers already in place.

    The problem is the site doesn't send the cookies along with the Headers if the browser doesn't support cookies. Essentially all I'm wondering is if there's a way to 'trick' the site into thinking you're using a browser that does support cookies.

      Yep, when you're sending the page request via curl, you can specify the headers to send with the request. CURLOPT_USERAGENT is how you tell the remote server what browser software you are using - you can set this to an appropriate internet explorer or mozilla version.

      See this PHPBuilder article for more details..

        Write a Reply...