Log the request to log, in order to facilitate subsequent troubleshooting, in PHP to call a method, the implementation of the curl string can be recorded to facilitate the replication request.
Java code
$value) { if (substr ($name, 0, 5) = = ' Http_ ') { $headers [Str_replace (', '-', Ucwords (Strtolower (' _ ', ', substr ($name, 5)))])] = $value; }} } foreach ($headers as $key = + $value) { if ($key = = ' accept-encoding ') $value = Str_replace (' gzip, ', ' ', $value); $curlCommand. = '-h '. $key. ':' . $value. '"'; } return $curlCommand; } catch (Exception $e) { return $e->getmessage ();} } Echo Getcurlcommand ();
eg
Java code
Curl "HTTP://LOCALHOST/OTHER/SERVERINFO.PHP?DD=DDD"-H "host:localhost"-H "connection:keep-alive"-H "Cache-control: Max-age=0 "-H" accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 "-H" User-Agent: mozilla/5.0 (Windows NT 6.1; WOW64) applewebkit/537.36 (khtml, like Gecko) chrome/43.0.2357.132 safari/537.36 "-H" dnt:1 "-H" accept-encoding:deflate , SDCH "-H" accept-language:zh-cn,zh;q=0.8,en;q=0.6 "-H" cookie:name=shikiliu; Email=xishizhaohua%40qq.com "
Related articles:
To view the request response time method using the Curl command
Linux System Curl Command
Server-side PHP Build Curl command line