I am trying to get the html code of a protected page. I am aiming to restyle this page with css, so I need tho get the html code first !!!
I have a valid username and password.
I have tried to use cURL, but I always end up with this message: “the stub received bad data”
the url of the page is: http://student.guc.edu.eg
Do you have any code already? You need to use code such as this, utilising
CURLOPT_HTTPAUTHandCURLOPT_USERPWDspecifically.CURLOPT_HTTPAUTHThe HTTP authentication method(s) to use. The options are: CURLAUTH_BASIC, CURLAUTH_DIGEST, CURLAUTH_GSSNEGOTIATE, CURLAUTH_NTLM, CURLAUTH_ANY, and CURLAUTH_ANYSAFE.
The bitwise | (or) operator can be used to combine more than one method. If this is done, cURL will poll the server to see what methods it supports and pick the best one.
CURLAUTH_ANY is an alias for CURLAUTH_BASIC | CURLAUTH_DIGEST | CURLAUTH_GSSNEGOTIATE | CURLAUTH_NTLM.
CURLAUTH_ANYSAFE is an alias for CURLAUTH_DIGEST | CURLAUTH_GSSNEGOTIATE | CURLAUTH_NTLM.
CURLOPT_USERPWDA username and password formatted as “[username]:[password]” to use for the connection.
Looking at the headers returned from the site http://student.guc.edu.eg/, it’s as follows:
This means that rather than using
CURLAUTH_BASIC, you should tryCURLAUTH_NTLM, and see if that helps.