我有这个链接:
如果你访问它,这将成为:
如何从第一个链接获取第二个链接?
我试过这个但是没有用,给我的第一个链接回复:
<?php
$url="http://libero-news.it.feedsportal.com/c/34068/f/618095/s/2e34796f/l/0L0Sliberoquotidiano0Bit0Cnews0C12735670CI0Esaggi0Eper0Ele0Eriforme0Ecostituzionali0EChiaccherano0Ee0Eascoltano0Bhtml/story01.htm";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$a = curl_exec($ch);
print_r($a);echo"<br>";
if(preg_match('#Location: (.*)#', $a, $r)){
$l = trim($r[1]);
echo $l;
}else echo "not working";
?>
Run Code Online (Sandbox Code Playgroud)
非常感谢.
我正试图从远程URL获取图像的文件大小,我正试图像这样:
$remoteUrl = $file->guid;
//remote url example: http://myApp/wp-content/uploads/2017/05/Screen-Shot-2017-05-08-at-10.35.54.png
$fileSize = filesize($remoteUrl);
Run Code Online (Sandbox Code Playgroud)
但是,我得到:
filesize():http://myApp/wp-content/uploads/2017/05/Screen-Shot-2017-05-08-at-10.35.54.png的统计信息失败