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
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. =/

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.