B
B
Baha Rustamov2015-12-22 16:00:39
PHP
Baha Rustamov, 2015-12-22 16:00:39

How to parse preg_match correctly?

On the VK website, you need to parse hash, (Photo: cs629431.vk.me/v629431117/2677f/ODUBsXtSCNU.jpg ), marked in red that you need to parse it, how exactly to parse it, tried like this:

<?php
  // Тут код авторизации для получение куков и т.д

  $photoGet = curl("http://vk.com/photo".$photo);
  preg_match("/\"desc\":\"\",\"hash\":\"(.*?)\",/", $photoGet, $hash);
  Echo $hash[1];
?>

But this is how it parses the first hash, but I need what is in the red frame, please help :)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
wol_fi, 2015-12-22
@by133312

But this is how it parses the first hash, and I need what is in the red frame

well, then preg_match_all and count the results in a loop, but this is some kind of crutch.
why parse the frontend contact when everything can be pulled through api?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question