Advertisement
Guest User

Untitled

a guest
Jun 21st, 2011
4,328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. As of php 5.3 CURLOPT_PROGRESSFUNCTION its supported here's how:
  2.  
  3. <?php
  4.  
  5. function callback($download_size, $downloaded, $upload_size, $uploaded)
  6. {
  7. // do your progress stuff here
  8. }
  9.  
  10. $ch = curl_init('http://www.example.com');
  11.  
  12. // This is required to curl give us some progress
  13. // if this is not set to false the progress function never
  14. // gets called
  15. curl_setopt($ch, CURLOPT_NOPROGRESS, false);
  16.  
  17. // Set up the callback
  18. curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, 'callback');
  19.  
  20. // Big buffer less progress info/callbacks
  21. // Small buffer more progress info/callbacks
  22. curl_setopt($ch, CURLOPT_BUFFERSIZE, 128);
  23.  
  24. $data = curl_exec($ch);
  25.  
  26. ?>
  27.  
  28. Hope this help.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement