 |
[PHP]
เอาปัญหามาให้พี่ๆช่วยอีกแระ สอบถามแนวทางหรือวิธีการดึง code จากเว็บอื่นค่ะ |
|
 |
|
|
 |
 |
|
งงจริงๆค่ะ พอมีตัวอย่างที่เห็นชัดมั้ยคะ
สมมุติหนูเขียน
<html>
<title>ทดสอบในการแสดงผล</title>
<head>
</head>
<body>
....
...
..
</body>
</html>
ต้องการดึงสิ่งทีอยู่ในระหว่าง <title>...</title>
ต้องเขียนยังไงคะ
ขอบคุณค่ะ
|
 |
 |
 |
 |
Date :
2017-10-04 00:21:52 |
By :
because |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
คำค้น php:get value of text with preg_match_all
|
 |
 |
 |
 |
Date :
2017-10-04 07:31:13 |
By :
Chaidhanan |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ถ้าจะดึงค่าระหว่าง title แนะนำ http://simplehtmldom.sourceforge.net/
มันจะมี lib : simple_html_dom.php ไม่น่าจะยาก
ตัวอย่างการดึง title จาก thaicreate.com
01. require_once ( 'dom/simple_html_dom.php' );
03. $target = file_get_html( $domain );
04. $i = 0;
05. foreach ( $target ->find( 'title' ) as $el ) {
06. echo $el ->plaintext;
07. }
08. $target ->clear();
09. unset( $target );
ผลลัพธ์ : PHP, ASP, ASP.NET, VB.NET, C#, Java, jQuery, Mobile, Android, Windows Phone, iOs, iPhone, iPad,... Free Tutorials Online Examples
ต้นฉบับ

|
 |
 |
 |
 |
Date :
2017-10-05 11:07:45 |
By :
apisitp |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|