MgicalaEarner
Elite Member
- Jul 8, 2017
- 3,749
- 4,861
So basically i have got a challenge from my friend , i have some basics knowledge.
So challenge is i the codes need to fetch Title and description from youtube.
I am using Curl for this , so far this is what i have done
this is where i think i am doing wrong and idk what is the correct regex i use, any help will be much much appreciated.
Thanks
So challenge is i the codes need to fetch Title and description from youtube.
I am using Curl for this , so far this is what i have done
If you check this code $re = ""title":{"runs":[{"text":"(.*?)"}]";header('content-type:text/plain');
$curl = curl_init();
curl_setopt($curl , CURLOPT_URL , "https://www.youtube.com/results?search_query=curl+php+scrape+title");
curl_setopt($curl , CURLOPT_SSL_VERIFYPEER , FALSE);
curl_setopt($curl , CURLOPT_RETURNTRANSFER , 1); #always use 1 instead of url else it won't work
$result = curl_exec($curl);
$re = ""title":{"runs":[{"text":"(.*?)"}]";
preg_match_all($re, $result, $result, PREG_SET_ORDER, 0);
print_r ($result);
this is where i think i am doing wrong and idk what is the correct regex i use, any help will be much much appreciated.
Thanks
Last edited: