Skip to content

Instantly share code, notes, and snippets.

@sairion
Created October 1, 2013 14:39
Show Gist options
  • Save sairion/6779546 to your computer and use it in GitHub Desktop.
Save sairion/6779546 to your computer and use it in GitHub Desktop.
Using curl in PHP
<?php
$c = curl_init('http://google.com');
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
//curl_setopt(... other options you want...)
$html = curl_exec($c);
if (curl_error($c)){ die(curl_error($c)); }
// Get the status code
$status = curl_getinfo($c, CURLINFO_HTTP_CODE);
curl_close($c);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment