Advertisement
Guest User

Untitled

a guest
May 30th, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. function getContents($thisURL) {
  2. $strURL = "$thisURL";
  3. $resURL = curl_init();
  4. $ch = curl_init();
  5. curl_setopt($ch,CURLOPT_ENCODING,'gzip');
  6. curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 );
  7. curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  8. curl_setopt($ch, CURLOPT_TIMEOUT, 60);
  9. curl_setopt($ch, CURLOPT_HEADER, 0);
  10. curl_setopt($ch, CURLOPT_URL, $strURL);
  11. $data = curl_exec($ch);
  12. curl_close($ch);
  13. return $data;
  14. }
  15.  
  16.  
  17. $feed = getContents("http://feeds.finance.yahoo.com/rss/2.0/headline?s=AAPL&region=US&lang=en-US");
  18.  
  19. file_get_contents("http://feeds.finance.yahoo.com/rss/2.0/headline?s=AAPL&region=US&lang=en-US");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement