Created
October 11, 2013 07:49
-
-
Save josuecau/6931095 to your computer and use it in GitHub Desktop.
cURL PHP examples
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 | |
$curl = curl_init(); | |
curl_setopt($curl, CURLOPT_URL, 'http://domain.tld'); | |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); | |
$return = curl_exec($curl); | |
curl_close($curl); |
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 | |
$curl = curl_init(); | |
curl_setopt($curl, CURLOPT_URL, 'http://domain.tld'); | |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt($curl, CURLOPT_POST, true); | |
curl_setopt($curl, CURLOPT_POSTFIELDS, array( | |
'foo' => 'bar' | |
)); | |
$return = curl_exec($curl); | |
curl_close($curl); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment