我想用它来测量下载图像需要多长时间,然后我可以用其他内容类型进行相同的测量。
我找到了一个相关的例子:并分享它。
# Parse the image tags $img_tag_array = parse_array($web_page['FILE'], ""); if(count($img_tag_array)==0) {echo "No images found at $target\n"; exit; }
DIY的共鸣是自动化,这是更大框架的一部分。
答案 0 :(得分:0)
为什么不简单,下载谷歌浏览器并使用网络开发工具查看下载图像所需时间的详细统计数据?看起来你已经过度复杂了,除非我误解了你想要做什么?
答案 1 :(得分:0)
找到了我想要的功能,所以我在分享:
function download_images_for_page($target) { echo "target = $target\n"; # Download the web page $web_page = http_get($target, $referer=""); # Update the target in case there was a redirection $target = $web_page['STATUS']['url']; # Strip file name off target for use as page base $page_base=get_base_page_address($target); # Identify the directory where iamges are to be saved $save_image_directory = "saved_images_".str_replace("http://", "", $page_base); # Parse the image tags $img_tag_array = parse_array($web_page['FILE'], ""); if(count($img_tag_array)==0) { echo "No images found at $target\n"; exit; } # Echo the image source attribute from each image tag for($xx=0; $xx