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: &nbsp;<input name=user type=text length=20 value= ><br>  access key: <input name=key type=password length=11 > &nbsp;   <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

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -