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

  • SEARCH
  • Home
  • 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 7174057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:57:12+00:00 2026-05-28T15:57:12+00:00

I am trying to retrieve this page using curl in php. This page of

  • 0

I am trying to retrieve this page using curl in php. This page of course requires you to log in because it displays different apps for each user. I have been following the work done on this page, however am not having much success.

So far, in his example I am able to successfully populate the auth variable with the auth token. In the next step however (Below the comment for logging into Android Market) I run into troubles. The output variable that he says should have a 302 code results in a “The document has moved” page which links me back to the Google log in page.

Here is a pastebin to show exactly what I am trying. http://pastebin.com/9Fs9GWxk
Additionally if anyone knows what steps I need to do after this to actually get the page I need that would be amazing. Thanks

  • 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-28T15:57:13+00:00Added an answer on May 28, 2026 at 3:57 pm

    Here is something I came up with today for this question that has been modified to work for you:

    <?php
    
    $USERNAME = 'you@gmail';
    $PASSWORD = 'yourpasswd';
    
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Ubuntu; X11; Linux x86_64; rv:9.0.1) Gecko/20100101 Firefox/9.0.1");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_COOKIEJAR, COOKIEJAR);
    curl_setopt($ch, CURLOPT_COOKIEFILE, COOKIEJAR);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120);
    curl_setopt($ch, CURLOPT_TIMEOUT, 120);
    
    curl_setopt($ch, CURLOPT_URL, 
      'https://accounts.google.com/ServiceLogin?hl=en&continue=https://market.android.com/mylibrary');
    $data = curl_exec($ch);
    
    $formFields = getFormFields($data);
    
    $formFields['Email']  = $USERNAME;
    $formFields['Passwd'] = $PASSWORD;
    unset($formFields['PersistentCookie']);
    
    // var_dump($formFields);
    
    $post_string = '';
    foreach($formFields as $key => $value) {
        $post_string .= $key . '=' . urlencode($value) . '&';
    }
    
    $post_string = substr($post_string, 0, -1);
    
    curl_setopt($ch, CURLOPT_URL, 'https://accounts.google.com/ServiceLoginAuth');
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post_string);
    
    $result = curl_exec($ch); 
    //var_dump($result);
    
    if (preg_match('/^2\d{2}/', curl_getinfo($ch, CURLINFO_HTTP_CODE)) == false) {
        die("Login failed");
        var_dump(curl_getinfo($ch), $result);
    } else {
        curl_setopt($ch, CURLOPT_URL, 'https://market.android.com/mylibrary');
        curl_setopt($ch, CURLOPT_POST, 0);
        curl_setopt($ch, CURLOPT_HTTPGET, true); 
    
        $result = curl_exec($ch); 
        echo $result;
    }
    
    function getFormFields($data)
    {
        if (preg_match('/(<form id=.?gaia_loginform.*?<\/form>)/is', $data, $matches)) {
            $inputs = getInputs($matches[1]);
    
            return $inputs;
        } else {
            die('didnt find login form');
        }
    }
    
    function getInputs($form)
    {
        $inputs = array();
    
        $elements = preg_match_all('/(<input[^>]+>)/is', $form, $matches);
    
        if ($elements > 0) {
            for($i = 0; $i < $elements; $i++) {
                $el = preg_replace('/\s{2,}/', ' ', $matches[1][$i]);
    
                if (preg_match('/name=(?:["\'])?([^"\'\s]*)/i', $el, $name)) {
                    $name  = $name[1];
                    $value = '';
    
                    if (preg_match('/value=(?:["\'])?([^"\'\s]*)/i', $el, $value)) {
                        $value = $value[1];
                    }
    
                    $inputs[$name] = $value;
                }
            }
        }
    
        return $inputs;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to retrieve data from a page which first requires to log
I'm trying to parse the output of this page -> http://master.anti3d.com/raw_server_list2.php The documentation of
I am trying to retrieve the image url in from this html page The
I'm receiving the following error with this page while trying to retrieve information from
I'm trying to retrieve a variable from an extended class. This is how my
Iam trying to retrieve data from mysql database into stylesheet.php but it is not
I'm trying to retrieve a file from a server using SFTP (as opposed to
Basically I am trying to retrieve a list of stored procedure parameters using Linq
I'm trying to retrieve images from a folder using glob() and i want it
I am trying to update a KnockOutJS page using an Ajax call. The Update

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.