$url, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_HTTPHEADER => [ "x-rapidapi-host: private-zillow.p.rapidapi.com", "x-rapidapi-key: 086ac2ec79mshedfa84e5360168ap19a3ccjsn5d8ae1750d03" ], ]); $result = curl_exec( $curl ); if ( curl_errno( $curl ) ) { error_log('CURL Error: ' . curl_error( $curl )); throw new \Exception( 'CURL Error: ' . curl_error( $curl ) ); } $status = curl_getinfo( $curl, CURLINFO_HTTP_CODE ); curl_close( $curl ); if ( $status !== 200) { error_log("Failed to fetch data, HTTP status: $status"); throw new \Exception( "Failed to fetch data, HTTP status: $status" ); } return $result; } }