Advertisement
Guest User

Untitled

a guest
Sep 24th, 2018
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. $ch = curl_init();
  2. curl_setopt($ch, CURLOPT_URL, 'http://37.233.18.11:2639/ws_getstock?ranges=all');
  3. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  4. curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
  5. curl_setopt($ch, CURLOPT_CONNECTTIMEOUT ,0);
  6. curl_setopt($ch, CURLOPT_TIMEOUT, 300);
  7. //curl_setopt($ch, CURLOPT_USERPWD, '[onlineshop]:[onlineshop]');
  8. $username=$password='onlineshop';
  9. curl_setopt($ch, CURLOPT_HTTPHEADER,
  10. array(
  11. "Authorization: Basic " . base64_encode($username . ":" . $password)
  12. ));
  13. $data = curl_exec($ch);
  14. if(!curl_exec($ch)){
  15. die('Error: "' . curl_error($curl) . '" - Code: ' . curl_errno($ch));
  16. }
  17. file_put_contents(realpath('public').'/ws_getstock.xml',$data);
  18. curl_close($ch);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement