php - cURL returns same results with different query -
curl returns same results different query ajax. if copy query in url field of browser, works , returns correct results. test.php
<?php header("content-type: text/html; charset=iso-8859-1"); curl_setopt($c, curlopt_fresh_connect, 1); // don't use cached version of url $query = $_get['query']; $source = $_get['source']; $startdate = $_get['startdate']; $enddate = $_get['enddate']; if($query != ""){ $query = '%20and%20' . $query ;} $req = '...:['. $startdate .'t00:00:00z%20to%20'. $enddate .'t00:00:00z]%20and%20origin:'. $source . $query; $curl1 = curl_init($req); curl_setopt($curl1,curlopt_fresh_connect, true); curl_setopt($curl1,curlopt_returntransfer, true); $result = curl_exec($curl1); echo $result;
script.js
$.ajax({ url : 'test.php', type: 'get', datatype: 'json', cache:false, data: {'query': query, 'source': source, 'startdate': startdate, 'enddate': enddate, 'interaction': interaction}, success: function(source){ data = source; loadtable(); }, error: errorajax });
Comments
Post a Comment