0

i am new to php i want to filter data from html here is my code

<?php

 $curl = curl_init();

 curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => 'https://lookup-id.com/',
CURLOPT_USERAGENT => 'Sample cURL Request',
CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => 'fburl=https%3A%2F%2Fwww.facebook.com%2Fzuck&check=Lookup'


 ));

$resp = curl_exec($curl);

 curl_close($curl);
 echo $resp;
 $rr = preg_match('/\<p id\=\"code-wrap\"\>\<span id\=\"code\"\>/' , $resp); 


?>

this script returning me whole HTML page but i need only some data like: 1- Name of Facebook account 2- Numeric ID of facebook account

how can i filter these 2 things from output??

i need only this part

   Success! If Facebook name is Mark Zuckerberg, then we found your numeric 
  ID:
    4
bigsmoke
  • 101
  • 1
  • 1
  • 5
  • use `DOMDocument` and `DOMXPath` rather than a regex... using a regex to parse html is going to be painful – Professor Abronsius Aug 08 '18 at 21:11
  • The curl part is entirely irrelevant to your question. You can use a regex, if versed enough. (Extraction should not be confused with parsing). Albeit a DOM traversal *frontend* is simpler in this case `qphtml('.span12 .success em, .span12 #code')` – mario Aug 08 '18 at 21:17

0 Answers0