Created
August 26, 2013 19:31
-
-
Save dars/6345609 to your computer and use it in GitHub Desktop.
php curl debug
This file contains hidden or 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 | |
$verbose = fopen('php://temp', 'rw+'); | |
$options = array( | |
CURLOPT_RETURNTRANSFER => 1, // 不直接印出結果 | |
CURLOPT_URL => $target_url, | |
CURLOPT_POST => true, | |
CURLOPT_POSTFIELDS => $query_string, //$data, // 直接給array | |
CURLOPT_VERBOSE => true, | |
CURLOPT_STDERR => $verbose | |
); | |
curl_setopt_array($ch, $options); | |
$result = curl_exec($ch); | |
curl_close($ch); | |
!rewind($verbose); | |
$verboseLog = stream_get_contents($verbose); | |
echo '<pre>debug:'; | |
var_dump($verboseLog); | |
echo $query_string."\n"; | |
var_dump($result); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment