cURL数据无法正常工作

时间:2017-09-16 09:13:41

标签: php json curl file-get-contents

我无法获得html输出,可能是什么问题?数据以标签形式出现,而非html!

function curl_get_contents($url)
{
  $ch = curl_init($url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  $data = curl_exec($ch);
  curl_close($ch);
  return $data;
}
$url = 'https://www.cosmetica.com.tr/tr/arama-sonuclari-8697888010218';
$json = curl_get_contents($url);

preg_match_all('@<a ng-href="(.*?)>@si',$json,$source);
print_r($source[0][0]);

html输出:blabla.com.tr/{{slugify(category.name)} }-c-{{category.id}} 链接标签来:例如{{slugify(subCategory.name)}}

但链接看起来像html,例如blabla.com//tr/p-art-net-far-karistirma-fircasi-no25-31770

0 个答案:

没有答案