Quick actions

cmd+k|ctrl+k

Navigation

Languages

test_curl_getinfo

Snippet info

Language

Php

Visibility

public

Author

fenghestudio

Created

2019-09-17T04:49:51Z

Updated

2019-09-17T04:49:51Z

<?php

// 创建一个cURL句柄
$ch = curl_init('http://www.yahoo.com/');

// 执行
curl_exec($ch);

// 检查是否有错误发生
if(!curl_errno($ch))
{
 $info = curl_getinfo($ch);

 echo 'Took ' . $info['total_time'] . ' seconds to send a request to ' . $info['url'];

}
// Close handle
curl_close($ch);

?>
INFO