goodwide
หัวหน้าแก๊งเสียว
พลังน้ำใจ: 66
ออฟไลน์
กระทู้: 1,432
|
|
« เมื่อ: 16 กุมภาพันธ์ 2019, 11:12:19 » |
|
มาแจก Code fuction [php] scarping ดึง youtube ครับผม
<?php
ini_set('max_execution_time', 0); ini_set("memory_limit", "1024M"); require_once 'lib/simple_html_dom.php'; header("Content-Type: text/html; charset=utf-8");
function sch_idyoutube($keyword){
$query = $keyword; $url = 'http://www.google.co.th/search?tbm=vid&source=lnms&tbm=vid&sa=X&q='.urlencode($query).''; $scrape = file_get_contents_curl($url); $doms = new simple_html_dom(); $doms->load($scrape);
foreach( $doms->find('div[id=ires]') as $element){ $item['url'] = $element->find('a',0)->href ; $urldata = $item; }
$xurl = explode("&", $urldata['url']); $tidyoutube = substr($xurl[0],-11); return $tidyoutube; }
?>
ส่วน libraly simple_html_dom ไปโหลดได้ที่ http://simplehtmldom.sourceforge.net/ นะจ๊ะ... ขอกำลังจัย หน่อย
|
|
« แก้ไขครั้งสุดท้าย: 16 กุมภาพันธ์ 2019, 11:15:21 โดย goodwide »
|
บันทึกการเข้า
|
|
|
|
phichetkung
คนรักเสียว
พลังน้ำใจ: 5
ออฟไลน์
กระทู้: 165
|
|
« ตอบ #1 เมื่อ: 16 กุมภาพันธ์ 2019, 23:13:09 » |
|
มาแจก Code fuction [php] scarping ดึง youtube ครับผม
<?php
ini_set('max_execution_time', 0); ini_set("memory_limit", "1024M"); require_once 'lib/simple_html_dom.php'; header("Content-Type: text/html; charset=utf-8");
function sch_idyoutube($keyword){
$query = $keyword; $url = 'http://www.google.co.th/search?tbm=vid&source=lnms&tbm=vid&sa=X&q='.urlencode($query).''; $scrape = file_get_contents_curl($url); $doms = new simple_html_dom(); $doms->load($scrape);
foreach( $doms->find('div[id=ires]') as $element){ $item['url'] = $element->find('a',0)->href ; $urldata = $item; }
$xurl = explode("&", $urldata['url']); $tidyoutube = substr($xurl[0],-11); return $tidyoutube; }
?>
ส่วน libraly simple_html_dom ไปโหลดได้ที่ http://simplehtmldom.sourceforge.net/ นะจ๊ะ... ขอกำลังจัย หน่อย เอาไป 10 ดาวครับ
|
|
|
บันทึกการเข้า
|
|
|
|
!Blogger SEO~~
หัวหน้าแก๊งเสียว
พลังน้ำใจ: 332
ออฟไลน์
กระทู้: 2,932
|
|
« ตอบ #2 เมื่อ: 17 กุมภาพันธ์ 2019, 00:52:40 » |
|
มาแจก Code fuction [php] scarping ดึง youtube ครับผม
<?php
ini_set('max_execution_time', 0); ini_set("memory_limit", "1024M"); require_once 'lib/simple_html_dom.php'; header("Content-Type: text/html; charset=utf-8");
function sch_idyoutube($keyword){
$query = $keyword; $url = 'http://www.google.co.th/search?tbm=vid&source=lnms&tbm=vid&sa=X&q='.urlencode($query).''; $scrape = file_get_contents_curl($url); $doms = new simple_html_dom(); $doms->load($scrape);
foreach( $doms->find('div[id=ires]') as $element){ $item['url'] = $element->find('a',0)->href ; $urldata = $item; }
$xurl = explode("&", $urldata['url']); $tidyoutube = substr($xurl[0],-11); return $tidyoutube; }
?>
ส่วน libraly simple_html_dom ไปโหลดได้ที่ http://simplehtmldom.sourceforge.net/ นะจ๊ะ... ขอกำลังจัย หน่อย 56->57 Thank you ครับ
|
|
|
บันทึกการเข้า
|
|
|
|
|
del555
สมุนแก๊งเสียว
พลังน้ำใจ: 20
ออฟไลน์
กระทู้: 912
|
|
« ตอบ #4 เมื่อ: 28 กุมภาพันธ์ 2019, 20:51:37 » |
|
|
|
|
บันทึกการเข้า
|
|
|
|
Thairanking
ก๊วนเสียว
พลังน้ำใจ: 9
ออฟไลน์
กระทู้: 310
|
|
« ตอบ #5 เมื่อ: 28 กุมภาพันธ์ 2019, 21:05:21 » |
|
|
|
|
บันทึกการเข้า
|
|
|
|
wookky
หัวหน้าแก๊งเสียว
พลังน้ำใจ: 46
ออฟไลน์
กระทู้: 1,356
|
|
« ตอบ #6 เมื่อ: 28 กุมภาพันธ์ 2019, 21:15:52 » |
|
เยี่ยมเลย 60
|
|
« แก้ไขครั้งสุดท้าย: 28 กุมภาพันธ์ 2019, 21:18:12 โดย wookky »
|
บันทึกการเข้า
|
|
|
|
cloudsphere
เจ้าพ่อบอร์ดเสียว
พลังน้ำใจ: 229
ออฟไลน์
กระทู้: 6,198
|
|
« ตอบ #7 เมื่อ: 28 กุมภาพันธ์ 2019, 21:23:13 » |
|
61 ครับ
|
|
|
บันทึกการเข้า
|
|
|
|
OptimusPrime
หัวหน้าแก๊งเสียว
พลังน้ำใจ: 59
ออฟไลน์
กระทู้: 1,065
|
|
« ตอบ #8 เมื่อ: 28 กุมภาพันธ์ 2019, 21:59:52 » |
|
ขอบคุณครับบบ
|
|
|
บันทึกการเข้า
|
- คิดจะพัก คิดถึงภาระ
|
|
|
hirase8888
สมุนแก๊งเสียว
พลังน้ำใจ: 42
ออฟไลน์
กระทู้: 672
|
|
« ตอบ #9 เมื่อ: 28 กุมภาพันธ์ 2019, 22:09:49 » |
|
ขอบคุณครับ 60-61 นอกเรื่องนิด เค้าว่า php จะตายจริงหรือครับ
|
|
|
บันทึกการเข้า
|
|
|
|
Mrpoohling
ก๊วนเสียว
พลังน้ำใจ: 6
ออฟไลน์
กระทู้: 250
|
|
« ตอบ #10 เมื่อ: 01 มีนาคม 2019, 11:04:35 » |
|
มาแจก Code fuction [php] scarping ดึง youtube ครับผม
<?php
ini_set('max_execution_time', 0); ini_set("memory_limit", "1024M"); require_once 'lib/simple_html_dom.php'; header("Content-Type: text/html; charset=utf-8");
function sch_idyoutube($keyword){
$query = $keyword; $url = 'http://www.google.co.th/search?tbm=vid&source=lnms&tbm=vid&sa=X&q='.urlencode($query).''; $scrape = file_get_contents_curl($url); $doms = new simple_html_dom(); $doms->load($scrape);
foreach( $doms->find('div[id=ires]') as $element){ $item['url'] = $element->find('a',0)->href ; $urldata = $item; }
$xurl = explode("&", $urldata['url']); $tidyoutube = substr($xurl[0],-11); return $tidyoutube; }
?>
ส่วน libraly simple_html_dom ไปโหลดได้ที่ http://simplehtmldom.sourceforge.net/ นะจ๊ะ... ขอกำลังจัย หน่อย เก็บๆๆ ขอบคุณครับ
|
|
|
บันทึกการเข้า
|
|
|
|
ppttonline
สมุนแก๊งเสียว
พลังน้ำใจ: 16
ออฟไลน์
กระทู้: 686
|
|
« ตอบ #11 เมื่อ: 01 มีนาคม 2019, 11:36:45 » |
|
เยี่ยมเลยครับ
|
|
|
บันทึกการเข้า
|
|
|
|
gsoclub
สมุนแก๊งเสียว
พลังน้ำใจ: 111
ออฟไลน์
กระทู้: 928
|
|
« ตอบ #12 เมื่อ: 01 มีนาคม 2019, 11:45:18 » |
|
ขอบคุณครับผม
|
|
|
บันทึกการเข้า
|
|
|
|
khamingroup
ก๊วนเสียว
พลังน้ำใจ: 10
ออฟไลน์
กระทู้: 271
|
|
« ตอบ #13 เมื่อ: 01 มีนาคม 2019, 11:50:13 » |
|
ขอบคุณครับผม
|
|
|
บันทึกการเข้า
|
|
|
|
tarrekup
เจ้าพ่อบอร์ดเสียว
พลังน้ำใจ: 195
ออฟไลน์
กระทู้: 3,345
|
|
« ตอบ #14 เมื่อ: 01 มีนาคม 2019, 14:22:21 » |
|
เยี่ยมครับ
|
|
|
บันทึกการเข้า
|
แนะนำเครื่องมือ : |||| โฮสต์ไทย ถูก & ดี คลิก |||| จดโดเมนที่ namecheap คลิก
|
|
|
|