Advertisement
Guest User

Untitled

a guest
Feb 18th, 2020
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. $headers = [];
  2. $ch = curl_init();
  3. curl_setopt($ch, CURLOPT_URL, 'https://i.instagram.com/api/v1/' . $url);
  4. curl_setopt($ch, CURLOPT_USERAGENT, 'Instagram 107.0.0.27.121 Android (11/1.3.1; 240; 768x1024; samsung; GT-I9100; GT-I9100; smdkc210; en_US)');
  5. curl_setopt($ch, CURLOPT_ENCODING, "gzip");
  6. curl_setopt($ch, CURLOPT_HEADER, true);
  7. curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  8. curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookies/'."{$cooki}-cookies.log"); // куда писать кукисы
  9. curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookies/'."{$cooki}-cookies.log"); // откуда считывать кукисы
  10. curl_setopt($ch, CURLOPT_PROXY, $proxy);
  11. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  12. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  13. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  14. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  15. curl_setopt($ch, CURLOPT_POST, true);
  16.  
  17. if ($post_data) {
  18. curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
  19. }
  20.  
  21. $resp = curl_exec($ch);
  22. $header_len = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
  23. $header = substr($resp, 0, $header_len);
  24. $body = substr($resp, $header_len);
  25. curl_close($ch);
  26. return [$header, $body];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement