Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3307086
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:21:54+00:00 2026-05-17T21:21:54+00:00

I am trying to learn to use PHP curl and it seemed to go

  • 0

I am trying to learn to use PHP curl and it seemed to go well until I have tried to authenticate to changeip.com. Here is the function I use to make a Curl call:

function request($ch, $url, $params = array())
{   
    $options            = array
    (
        CURLOPT_URL                 => $url,
        CURLOPT_USERAGENT           => 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8',
        //CURLOPT_COOKIESESSION     => TRUE,
        CURLOPT_FOLLOWLOCATION      => TRUE,
        CURLOPT_HEADER              => TRUE,
        CURLOPT_RETURNTRANSFER      => TRUE,
        CURLOPT_SSL_VERIFYPEER      => FALSE,
        CURLOPT_SSL_VERIFYPEER      => FALSE,
        CURLINFO_HEADER_OUT         => TRUE,
        CURLOPT_CONNECTTIMEOUT      => 30,
        CURLOPT_TIMEOUT             => 30,
        CURLOPT_MAXREDIRS           => 30,
        CURLOPT_VERBOSE             => TRUE,
        CURLOPT_COOKIEJAR           => __DIR__ . DIRECTORY_SEPARATOR . 'cookies.txt',
        CURLOPT_COOKIEFILE          => __DIR__ . DIRECTORY_SEPARATOR . 'cookies.txt',
        CURLOPT_HTTPHEADER          => array
        (
            'Host: www.changeip.com',
            'Pragma:',
            'Expect:',
            'Keep-alive: 115',
            'Connection: keep-alive',
            'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
            'Accept-Language: en-us,en;q=0.5',
            //'Accept-Encoding: gzip,deflate',
            'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7',
            'Content-Type: application/x-www-form-urlencoded',
        ),
    );

    if(!empty($params['referrer']))
    {
        $options[CURLOPT_REFERER]       = $params['referrer'];
    }

    if(!empty($params['post']))
    {
        $options[CURLOPT_POST]          = TRUE;
        $options[CURLOPT_POSTFIELDS]    = $params['post'];
    }

    curl_setopt_array($ch, $options);

    $return             = array();  
    $return['body']     = curl_exec($ch);
    $info               = curl_getinfo($ch);
    //die(var_dump( curl_getinfo($ch, CURLINFO_HEADER_OUT) ));
    $return['header']   = http_parse_headers(substr($return['body'], 0, $info['header_size']));
    $return['body']     = substr($return['body'], $info['header_size']);

    /*if(!empty($return['header']['Location']))
    {
        $params['referrer'] = $url;
        return request($ch, substr($url, 0, strrpos($url, '/')+1) . $return['header']['Location'], $params);
    }*/

    return $return;
}

And here is the actual call:

// chaneip
$ch                 = curl_init();

// login
$params             = array();
$params['post']     = array
(
    'p' => 'aaaaaa2',
    'u' => 'aaaaaa2',
);

$params['referrer'] = 'https://www.changeip.com/login.asp';

$return             = request($ch, 'https://www.changeip.com/loginverify.asp?', $params);

However, this script does not retrieve valid cookies from changeip.com, i.e., does not authenticate. I have tried to compare Curl sent headers with HTTPLiveHeaders expecting to find any difference but in the end I didn’t find anything. Can anyone advice me what is missing to make this work?

Commonly given question:
is cookie.txt 0777? Yes and the script does actually create some sort of cookie:
http://www.changeip.com FALSE / FALSE 0 ACloginAddrs 6
http://www.changeip.com FALSE / FALSE 0 ASPSESSIONIDCCSSCQRA DNHKGDICMKHFIJADMAPPMHHC

But it isn’t a valid cookie.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T21:21:54+00:00Added an answer on May 17, 2026 at 9:21 pm
    $options[CURLOPT_POSTFIELDS]    = http_build_query($params['post']);
    

    Fixed the issue.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to learn how to use oop in php. I'm also fairly new
I'm trying to learn how to use actionscript over mxml for flexibility. I have
I'm trying to learn to use PHP with an object oriented scheme. I think
I am trying to learn traits. I have used the example from PHP manual,
I'm trying to learn how to use CURL and Json to access data sent
I'm trying to learn how to use the library vcglib (http://vcg.sourceforge.net/index.php/Main_Page) but I'm having
In my quest in trying to learn more about OOP in PHP. I have
i'm quite new to php and trying to learn. I have 2 similiar classes.
I'm trying to learn how to use PHP's DOM functions . As an exercise,
I've trying to learn PHP OOP and have made some research on how to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.