Created
October 1, 2013 14:39
-
-
Save sairion/6779546 to your computer and use it in GitHub Desktop.
Using curl in PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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