我有一个问题,PHP的cURL返回一个带有一些URL的空字符串.我正在尝试解析不同网页的OG元数据,它适用于我尝试过的除NYTimes之外的所有网站.到目前为止,这是我的代码.
print_r(get_og_metadata('http://somewebsite.com'));
public function get_data($url)
{
$ch = curl_init();
$timeout = 5;
// the url to fetch
curl_setopt($ch, CURLOPT_URL, $url);
// return result as a string rather than direct output
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// set max time of cURL execution
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
public function get_og_metadata($url)
{
libxml_use_internal_errors(TRUE);
$data = $this->_get_data($url);
$doc = new DOMDocument();
$doc->loadHTML($data);
$xpath = new DOMXPath($doc);
$query = '//*/meta[starts-with(@property, \'og:\')]';
$metadatas = $xpath->query($query);
$result = array();
foreach($metadatas as $metadata) …
Run Code Online (Sandbox Code Playgroud) 我被聘请在新的PHP 5.3服务器上使用Laravel 4重建一个在CodeIgniter 1.7.3(在PHP 4.2服务器上)上构建的活跃应用程序.
该系统有大约500个用户,其密码使用salted SHA-1哈希进行加密.我想使用bcrypt来提高应用程序的安全性以及与Laravel 4的身份验证系统集成.
您如何建议迁移这些用户密码?