Jump to content

Recommended Posts

Posted

We get quite a few requests from staff 'can you make sure that ****** website is available for students to use' not a major issue, but I'd like to find a way of staff being able to test it for themselves easily. They already have a student login they can use, but few staff can be bothered and would rather ask us.

 

What I'd really like is a web based form to put on our intranet which staff can put a website URL into a box, that can then go out to the net through our proxy authenticated as a student and tell the staff member if the website is reachable or not. I've had a go using PHP and cURL but I can't get it to work properly, although I know in theory it's possible.

 

Anyone know of a pre-written script which will do this, or point me in the direction of a good understandable guide for using cURL properly.

 

Cheers

 

Mike.

Posted
If you could access its database, you could probably create a page that feeds the address in and see if its hits anyone in its database and returns a message based on that.
Posted
If you could access its database, you could probably create a page that feeds the address in and see if its hits anyone in its database and returns a message based on that.

 

Unfortunitely not possible to do that, as it's supplied and maintained by the LEA. I have access to the interface and nothing else.

 

My idea is to use a simple script to authenticate to the proxy as a student, see if the website is available or not and then report the result. Sounds simple enough but I just can't get it to work properly.

Posted
If you can turn on a warning page rather than a block for those pages that students cannot access, staff could view them and know if they were safe to use in class. To spell it out, I would make sure that you mention that the little darlings should not be viewing that page!
Posted
If you can turn on a warning page rather than a block for those pages that students cannot access, staff could view them and know if they were safe to use in class. To spell it out, I would make sure that you mention that the little darlings should not be viewing that page!

 

Our web filtering has different levels for staff and students and is a bit over the top sometimes, so ends up blocking sites that should really be available. e.g last week we found the marlowe theatre website was blocked for some reason, and other strange occurances like this, sites which you would assume would be available, that are perfectally harmless. Therefore I want an easy way for staff to find out if a particular website is blocked or not before they try and use it with a class, and also a method that avoids them asking us, as it takes up a fair amount of our time - I must get at least 3 or 4 of these type of requests a day, and many more where a member of staff has gone to use a site and suddenly discovered it's blocked then come running to us in a panic, some of this might be avoidable if staff can easily test if a site is blocked for students or not before they use it.

 

At the moment the code I've tried is not setup to accept an input from a form, I was just testing this bit of code with a hard programmed in website to see if I could get it to work. I have to admit I don't understand the cURL options witin PHP properly and I ripped this code from somewhere else, except it wasn't setup to use a proxy. As soon as I add the proxy options, it just reports every time as the website being un-reachable.

 

This bit of code should test to see if Google is available. If I remove the proxy lines it works, except it doesn't go through our proxy so it's no good. I just cannot get it to authenticate to our proxy whatever combination of different options I try.

 

function Visit($url){
      $agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";$ch=curl_init();
      curl_setopt ($ch, CURLOPT_URL,$url );
      curl_setopt($ch, CURLOPT_USERAGENT, $agent);
      curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
      curl_setopt ($ch,CURLOPT_VERBOSE,false);
      curl_setopt($ch, CURLOPT_TIMEOUT, 5);
      curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, FALSE);
      curl_setopt($ch,CURLOPT_SSLVERSION,3);
      curl_setopt($ch,CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1); 
curl_setopt($ch, CURLOPT_PROXY, '10.49.60.5:8080'); 
curl_setopt($ch, CURLOPT_PROXYUSERPWD, 'spires\student2:password2'); 

      $page=curl_exec($ch);
      //echo curl_error($ch);
      $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
      curl_close($ch);
echo $httpcode;
      if($httpcode>=200 && $httpcode<300) return true;
      else return false;
}

if (Visit("http://www.google.co.uk"))
      echo "Website available";
else
      echo "Website not available";
?>

 

Anyone see what I've done wrong?

 

Mike.

Posted
What sort of differences does your staff have compared to your students? The only differences we set here is staff can access all webmail providers and youtube - everything else is the same. The advantage of this is in theory if it works for a member of staff whilst planning a lesson it will work for the students.
Posted
What sort of differences does your staff have compared to your students? The only differences we set here is staff can access all webmail providers and youtube - everything else is the same. The advantage of this is in theory if it works for a member of staff whilst planning a lesson it will work for the students.

 

The main difference is uncategorised sites. They are available to staff, but not to students. This emcompasses quite a few more obscure sites that some staff want to use, things hosted on personal webspace and the like and also anything that's very new. There's other differences, and sometimes the odd site is blocked from students by keyword filtering and have to be added as a specific allow. We've just upgraded websense to the latest version as well which seems to have some sites in different categories to what they were before, so some staff are finding sites they've used before are no longer available and as such some have started running every single site they want to use past us before they use them. Not necessarily a bad thing, but it's starting to take up more of our time than I'd like testing them on behalf of the teacher, so I wanted to create an easy to use interface they could use to test them theirselves.

 

As I say they are supplied with a student login they can use on a workstation, but most complain they don't have the time to do this and expect us to do it, so I want to offer an alturnative that they can't complain about! As you can guess it's us that gets it in the neck when students can't get onto a site and the whole lesson is disrupted etc. etc.

Posted

PHP: curl_setopt - Manual

 

I don't know if this will help but, you haven't said how it'll authenticate and you haven't said the proxy type

CURLOPT_HTTPAUTH - The HTTP authentication method(s) to use for the proxy connection. Use the same bitmasks as described in CURLOPT_HTTPAUTH. For proxy authentication, only CURLAUTH_BASIC and CURLAUTH_NTLM are currently supported.

 

CURLOPT_PROXYTYPE - Either CURLPROXY_HTTP (default) or CURLPROXY_SOCKS5.

 

Unless it's a weird timeout issue and the script is taking longer than the timeout is allowing for?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...