Skip to content

Instantly share code, notes, and snippets.

@dars
Created August 26, 2013 19:31

Revisions

  1. dars created this gist Aug 26, 2013.
    22 changes: 22 additions & 0 deletions new_gist_file
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    <?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);