Posted By

tylerhall on 11/30/-1


Tagged

curl get url fetch


Versions (?)

Who likes this?

14 people have marked this snippet as a favorite

luman
jkochis
millisami
irdial
vali29
hudge
benrasmusen
TheTiger
josex
Nix
dantreacy
wirenaught
ringo380
tux-world


Fetch URL


 / Published in: PHP
 

  1. function geturl($url)
  2. {
  3. $ch = curl_init();
  4. $timeout = 5;
  5. curl_setopt($ch, CURLOPT_URL, $url);
  6. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  7. curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
  8. $html = curl_exec($ch);
  9. curl_close($ch);
  10. return $html;
  11. }

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: ebbalingur on October 2, 2008

Where do I put in the url I want to fetch??? :S

You need to login to post a comment.