我在PHP Curl和Cookies身份验证方面遇到了一些问题.
我有一个文件Connector.php,它对另一台服务器上的用户进行身份验证,并返回当前用户的cookie.
问题是我想用curl验证成千上万的用户,但它一次只为一个用户验证和保存COOKIES.
connector.php的代码是这样的:
<?php
if(!count($_REQUEST)) {
die("No Access!");
}
//Core Url For Services
define ('ServiceCore', 'http://example.com/core/');
//Which Internal Service Should Be Called
$path = $_GET['service'];
//Service To Be Queried
$url = ServiceCore.$path;
//Open the Curl session
$session = curl_init($url);
// If it's a GET, put the GET data in the body
if ($_GET['service']) {
//Iterate Over GET Vars
$postvars = '';
foreach($_GET as $key=>$val) {
if($key!='service') {
$postvars.="$key=$val&";
}
}
curl_setopt ($session, CURLOPT_POST, true);
curl_setopt ($session, …Run Code Online (Sandbox Code Playgroud) 我在PHP上使用file_get_contents,它会抛出一些错误:
我的代码
#try to fetch from remote
$this->remotePath = "http://some-hostname.com/blah/blah.xml
$fileIn = @file_get_contents($this->remotePath);
Run Code Online (Sandbox Code Playgroud)
错误:
Warning: file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration in /virtual/path/to/file/outputFile.php on line 127
Warning: file_get_contents(https://some-host-name/data/inputFile.xml) [function.file-get-contents]: failed to open stream: no suitable wrapper could be found in /virtual/path/to/file/outputFile.php on line 127
Run Code Online (Sandbox Code Playgroud)
任何的想法?它在我的计算机上工作正常但在我将其移植到Web服务器时停止工作.