Jump to content

Bleucube

New Members
  • Posts

    2
  • Joined

  • Last visited

Bleucube's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Howdy. First time poster, newbie coder. I've scanned the forums for the last couple hours and although there are some close answers - nothing works nor accomplishes my job. My goal: Scrape a website, find all youtube links, create a page with all videos found via iframe. My Issue: My code below works great, but all the URLS look like http://www.youtube.com/watch?v=xxxxxxxxxxx Not sure what to do. Should I use str_replace to change it from that to http://www.youtube.com/embed/xxxxxxxx ? Here's the code: <?php $curl = curl_init(); curl_setopt ($curl, CURLOPT_URL, "http://xxxxx"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec ($curl); curl_close ($curl); //links if(preg_match_all("/(http\:\/\/www\.youtube\.com\/watch\?v=\w{11})/", $result, $links)) { foreach($links[0] as $link) { echo $link."<br />"; } } ?> Thanks!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.