mysql - Add log in credentials to PHP file command -
i trying read file web address requires log in. have parameter as:
$data = file("http://rotoguru1.com/cgi-bin/mlb-dbd-2016.pl?&start=$dt");
the website defines log in with: username access key
<form name=login action=http://rotoguru1.com/cgi-bin/getcred.pl method=post > <input name=geturl type=hidden value="http://rotoguru1.com/cgi-bin/mlb-dbd-2016.pl?" > username: <input name=user type=text length=20 value= ><br> access key: <input name=key type=password length=11 > <input type=submit value="log in" ><br></form></td>
how add these definitions script?
this code send parameters perl script , , read it's response be, complete html code, along http response headers, have deal well!
$url = "http://rotoguru1.com/cgi-bin/getcred.pl"; $usrname=''; // user name here $access='';//your access key here $myvars = 'user='.$usrname.'&key='.$access; $ch = curl_init( $url ); curl_setopt( $ch, curlopt_post, 1); curl_setopt( $ch,curlopt_postfields, $myvars); curl_setopt( $ch,curlopt_followlocation, 1); curl_setopt( $ch, curlopt_header, 0); curl_setopt( $ch,curlopt_returntransfer, 1); $resp = curl_exec( $ch );
Comments
Post a Comment