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.
Originally Posted by Ric_
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.
Anyone see what I've done wrong?
$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_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
curl_setopt($ch, CURLOPT_PROXY, '10.49.60.5:8080');
curl_setopt($ch, CURLOPT_PROXYUSERPWD, 'spires\student2:password2');
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if($httpcode>=200 && $httpcode<300) return true;
else return false;
echo "Website available";
echo "Website not available";