+ 21

How To Login On A Website With PHP CURL and get data?

For Example:- Login On Sololearn With Email And Password and get own profile information;

19th Jan 2021, 6:04 PM
Mask Man(What's in a name?)
Mask Man(What's in a name?) - avatar
14 odpowiedzi
+ 6
Altero (Inactive) if you learn PHP then you got to know that login on a website is possible without database access
19th Jan 2021, 6:09 PM
Mask Man(What's in a name?)
Mask Man(What's in a name?) - avatar
+ 6
Do you want to scrape data? If yes then scraping data from sololearn's website is illegal even if it is your data. And for most of the websites it's illegal instead they provide an api to get data. But sololearn doesn't provide any api.
20th Jan 2021, 3:26 AM
Krish
Krish - avatar
+ 5
Altero (Inactive) i am giving you an example most of the website use form tag for login like below <form method="POST" action="login.php"> <!--username and password field--> </form> And if you submit this form your username and password goes to login.php page and they will verify that your details are correct or not. But Know I am trying to do same thing with PHP i will send username and password from my website to login.php and they will verify that details are correct or not and get me login
19th Jan 2021, 6:24 PM
Mask Man(What's in a name?)
Mask Man(What's in a name?) - avatar
+ 5
I'm not a php guy but I don't think if you can do it without storing it to any db. You need to remember the username and password in server side so that whenever user makes a request you can find the user from db and then match the password. Also you need to somehow convert passwords into hash string. But if you want to keep things simple. You can create variables and then make req to login.php and use the == to compare them. (Which is not ideal in production) And there are so many tutorials available on internet. Go ahead and watch them
19th Jan 2021, 7:31 PM
Shreyansh
Shreyansh - avatar
+ 4
Oh So you want to do web automation or smth Idk much about curl but here are some steps you can follow... I haven't tried it yet but it would work 1: go to login page and open dev tools 2: go to network and then xhr 3: now try to login with your email pass, it will make a post request to server. 4: now you will see a page icon or something like that. Click on that and copy the url. Then go to very bottom where it will show you the content that is sent to server.. Copy that. 5: Now time to code... You can follow any tutorial. Make a post request to the url and set the content to whatever you copied from dev tools. 6: Store response in a variable and now you can scrape it using any domParser library And as Krish [less active] said, it's not legal but "Inko kya hi pata chalega" Also I'd suggest you using python selenium as it gives you full control over browser. Also you can use nodeJs if you wanna go headless
20th Jan 2021, 9:23 AM
Shreyansh
Shreyansh - avatar
+ 3
I think you need database access if you are able to access database then only you can get your data otherwise if server provide any special service related database
19th Jan 2021, 6:07 PM
Sona
Sona - avatar
+ 3
I Am Not Trying To Do This On Sololearn. I Am Just Leaning To This To Truecaller
20th Jan 2021, 9:09 AM
Mask Man(What's in a name?)
Mask Man(What's in a name?) - avatar
+ 3
Krish [less active] the steps were for PHP And he can mail sl and ask for permission and again if they denied "Inko kya hi pta chalega" Also I've found that they have created an API which they use for fetching code playground data.
20th Jan 2021, 11:31 AM
Shreyansh
Shreyansh - avatar
+ 2
Krish [less active] Learning Of Hacking Is Good Because we can sucure our data by our hacking skill so i am just doing something like this
20th Jan 2021, 7:54 AM
Mask Man(What's in a name?)
Mask Man(What's in a name?) - avatar
+ 2
But sl team can take actions against your for these reasons. Be careful. Ans btw i am not stoping you you can do what you want i am just warning you to not to post the code any where as this can take you in trouble. Happy coding
20th Jan 2021, 9:08 AM
Krish
Krish - avatar
+ 2
Shreyansh "Inko kya hi pata chalega" Was awesome 😂😂😂😂😂 But i am warning then sop that in future they won't face any issue And also he want to do it with php And why to copy the request data when with selenium (if you use python) we can directly log in by providing out email address as we also need to provide those by hitting post request So better to directly log in with gui with selenium. Why to make it lengthier and complex though Btw again inko kya hi pata chalega 😂😂😂😂😂😂
20th Jan 2021, 11:15 AM
Krish
Krish - avatar
+ 2
Shreyansh I mailed them many times regarding this but they still denied 😞😞 But for context "inko kya hi pata chalega" I made a scraper and ran it on my pc 😂😂 Because inko kya hi pata chalega And the API is not public we can't use it as there isn't any docs for it But some people (including me 😝😝) have used this api to fetch profile pic https://code.sololearn.com/WsFHboT6zPh7/?ref=app And if they get to know about this and take any action they i have a small phrase "Krwa li bezzati, aagaya maza " 😂😂
20th Jan 2021, 11:36 AM
Krish
Krish - avatar
+ 1
𝐌𝐚𝐬𝐤 𝐌𝐚𝐧(नाम में क्या रखा है?) Login a website without database so where can you store your data Maybe you are talking about static Database ,am I right?
19th Jan 2021, 6:11 PM
Sona
Sona - avatar
+ 1
no answers here, just bullshit, stfu if you habe no answer on topic
21st Jan 2021, 4:58 PM
Pio Mey