D
D
Den442018-08-08 15:11:24
JSON
Den44, 2018-08-08 15:11:24

How to get one line from JSON using GET?

How to use GET from one server to get one string from a JSON object located on another server? And is it even possible?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
frees2, 2018-08-08
@Den44

The problem can be if they don’t let you in there, but if they let you through the browser and you can see json with the browser, then curl, there are plenty of examples on tyrnet how to imitate the browser.
You can also receive it through the anonymizer if they somehow ban them by writing a request through it, too, curl.
fetch(' https://toster.ru/q/yuuyuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu assssssssssssssssssssssssssssssssssssssssssssssssssss as you can?a= '+id+'zdraste', { method: 'get'})

$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $fff);
 curl_setopt($ch, CURLOPT_USERAGENT, 'PHP Bot');
 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  $json = curl_exec($ch);
  curl_close($ch);
  if ($json !== false) { 
//$json = preg_replace("#(/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/)|([\s\t]//.*)|(^//.*)#", '', $json);
setlocale(LC_ALL, 'ru_RU.utf8');
 Header("Content-Type: text/html;charset=UTF-8");
$json = json_decode($json, true) ; 
//print_r($json);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question