Jump to content

Log into a site through a form with php


dbz

Recommended Posts

Hello! I'm new to php and unfortunately have a problem already.

 

I'm trying to log into a website through a form so I can access the material on the webpage. I was told to use "curl" by a friend, and I (kinda) hijacked a script from a site showing how to do it.

 

script: http://pastebin.com/f73513d65

 

Sadly, the webhosting I use has curl disabled, so I was wondering if anyone could help me discover a different way of doing it. To be honest- I don't understand how curl works, so it was a bad idea to try it to begin with it anyways, but I figured I would try to get it to work and then try to understand it.

 

Thanks for reading and for any help you all provide!

Link to comment
https://forums.phpfreaks.com/topic/182699-log-into-a-site-through-a-form-with-php/
Share on other sites

Oooooh. I think I will include that in my project actually (at a later stage when designing a UI)! However, that's no quite what I need. I will be more clear.

 

My school has a webpage where one can get all the homework a class assigns daily; however, the website is organized *horribly*, and it takes the user about half an hour to grab all of the homework. (haha I know.) So I want to make a php script to log into my schools website, and grab the homework from all of the different pages.

 

And I'm a little stuck at the logging into my school's webpage part. =/

hai

open your php.ini file in the server and check for this option

extension=php_curl.dll

if it is commented then uncomment it off and i think the curl will work out for you..

to use the curl for an website use the below code to get it out

<?php
// create a new cURL resource
$ch = curl_init();
$demo='http://chaitu09986025424.blog.co.in/feed/rss/';
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "$demo");
curl_setopt($ch, curlopt_content_type,"text/xml");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLINFO_HEADER_OUT, true);

// grab URL and pass it to the browser
$data=curl_exec($ch);
$info=curl_getinfo($ch);
//var_dump(curl_getinfo($ch,CURLINFO_HEADER_OUT));
echo $info['http_code'];
print_r("$data");

?>

 

this should give you the result of the webpage

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.