我试图弄清楚为什么下面的代码仍然在命令行上输出,即使最后没有echo、print_r或var_dump命令。我希望在变量中获得输出以便进一步处理,但是$result变量只有boolean数据类型。
$data_string = '{"query":"{ ethereum(network: bsc) { arguments( smartContractAddress: {is: \"0xBCfCcbde45cE874adCB698cC183deBcF17952812\"} smartContractEvent: {is: \"PairCreated\"} argument: {not: \"pair\"} options: {desc: \"block.height\", limit: 10} ) { block { height timestamp { unixtime } } argument { name type } reference { address smartContract { currency { name } } } } }}","variables":"{}"}';
$headers = array('Content-Type: application/json', 'X-API-KEY: BQYI5KOkokFE3CBqPfQvldOhXwVKWEf8' );
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, 'https://graphql.bitquery.io/' );
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
curl_close($ch);
//Output displayed at the command line without me specifically print/echo it ???有没有人能帮我把输出正确地输出到变量$result?现在,我想要的输出直接显示在命令行上
发布于 2021-07-29 01:18:06
CURLOPT_RETURNTRANSFER,false
尝试添加此参数
https://stackoverflow.com/questions/68502942
复制相似问题