curl模拟安卓手机进行网络请求

$url = "http://somedomain/ver/ffffffff-e31e-85d5-ffff-ffffa6220605/2/en/b0:79:94:e7:99:4a/3.5";
$ch = curl_init($url); //初始化
curl_setopt($ch, CURLOPT_HEADER, 0); // 不返回header部分
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // 返回字符串,而非直接输出
curl_setopt($ch, CURLOPT_USERAGENT, "Dalvik/1.6.0 (Linux; U; Android 4.1.2; DROID RAZR HD Build/9.8.1Q-62_VQW_MR-2)");
curl_setopt($ch, CURLOPT_REFERER, "-");
$response = curl_exec($ch);
curl_close($ch);

print_r($response);

安卓手机userAgent:Mozilla/5.0 (Linux; U; Android 4.2.2; zh-cn; TCL S720T Build/JTQ46Y) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30

posted @ 2016-08-11 10:53  zqxLonely  阅读(3860)  评论(0编辑  收藏  举报