-2

Problem

I want to be able to login to my account, retrieve a value from a website while logged into my account, and then print it to a web page. In particular, I want to retrieve the number of problems I have solved from Project Euler and then print it to my website.

Now, I know how to retrieve a value from a particular web page.

My Code

Disclaimer: code taken and adapted from: get value from external webpage (php or java)

I have the following code to retrieve the next value I want from a web page:

<?php

// Read the whole file.
$lines = file('https://projecteuler.net/progress');

// Go through every line ..
while ($line = array_shift($lines)) {

    // Stop when you find the label we're looking for.
    //NOTE: The word 'Solved' only exists on the web page when you are logged into an account.
    if (strpos($line, 'Solved') !== false) break;

}

// The next line has your value on it.
$line = array_shift($lines);

// Print the first word on the line.
$values = explode(' ', $line);
echo $values[0];

?>

What this Code Actually Does

This code will go to the web page https://projecteuler.net/progress as it states. However, since this web page can be accessed without logging into the account, it will retrieve the values from that web page, instead of the web page that is accessed from logging in.

Essentially, there are two /progress pages - one for when you login, and one for when you are not logged in.

I want to be able to access the /progress page for when you are logged into your account. I have tried:

Things I've tried

I tried to use the information at this link: Reading information from a password protected site

With no success.

How might I do this?

Community
  • 1
  • 1
Baleroc
  • 167
  • 4
  • 15
  • Are you the developer of that website? – Alon Eitan Jun 04 '16 at 14:38
  • @AlonEitan Yes. I have my own website - which I want to retrieve data from Project Euler to add to it. – Baleroc Jun 04 '16 at 14:39
  • 1
    Your wording and description doesn't sound like you're the developer of the website, why don't you get in touch with Project Euler directly and ask their Tech guy(s) to work with you and provide you with the access you need? – Martin Jun 04 '16 at 14:42
  • 1
    try to use cuRL ;) – manniL Jun 04 '16 at 14:42
  • 2
    I'm voting to close this question as off-topic because this question seems to be about accessing privilaged content and a full working solution (if one exists) should probably not be made publicly available. – Martin Jun 04 '16 at 14:44

1 Answers1

1

The Project Euler website has a CAPTCHA on the login page. Possible ways to bypass this are well documented across the internet if you care to search, however the owner of the website clearly does not want automated access and, legal issues aside, we are generally disinclined to help you go against the wishes of the site's owners.

If you want to have your browser dump some data, when you are manually logged in, you might want to look into GreaseMonkey scripts.

Bardi Harborow
  • 1,803
  • 1
  • 28
  • 41
  • Let me clarify that: while I am logged into an account, I wish to retrieve information from my account to my website. – Baleroc Jun 04 '16 at 14:48
  • @AlonEitan What do you mean? I do apologise if it's seen as 'stealing', but could you explain? All I wanted is to be able to login to an account, to retrieve the amount of problems I solved at Project Euler to display in a web page. I did not know that was regarded as 'stealing'? – Baleroc Jun 04 '16 at 14:52
  • @Baleroc if it is your own account that you are trying to login to then you are not stealing your own information. But the whole point of a captcha is to prevent automated logins. If the site does not want you writing software to login, you should respect that. Trying to bypass it may have legal consequences. Ask the site owner if there is an API available to access the data you are interested in. – Remy Lebeau Jun 04 '16 at 15:00
  • @RemyLebeau That is precisely what I wanted to do. I wanted to be able to create a PhP File that accesses my account from Project Euler, then prints the problems Solved. I did not mean to bypass, or to 'steal', or 'hack' anything. If that is considered hacking - then I did not know. – Baleroc Jun 04 '16 at 15:01
  • @Baleroc, my initial answer was a little sharp. I've edited it. – Bardi Harborow Jun 04 '16 at 15:03