kakatoji

mengambil data log atau debug

Aug 15th, 2020
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. $ch = curl_init();
  2. curl_setopt($ch, CURLOPT_URL, $url);
  3. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  4. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  5. curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
  6. curl_setopt($ch, CURLOPT_HTTPHEADER, $ua);
  7. curl_setopt($ch, CURLOPT_VERBOSE, true);
  8. $verbose=fopen("php://temp","w");
  9. curl_setopt($ch, CURLOPT_STDERR, $verbose);
  10. $result = curl_exec($ch);
  11. if ($result === FALSE) {
  12. printf("cUrl error (#%d): %s\n", curl_errno($handle),
  13. (curl_error($handle)));
  14. }
  15.  
  16. rewind($verbose);
  17. $verboseLog = stream_get_contents($verbose);
  18.  
Add Comment
Please, Sign In to add comment