| | |
Getting the contents of a DIV on another page
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: May 2008
Posts: 232
Reputation:
Solved Threads: 19
Hi,
Is there any way to retrieve the contents of a DIV from another website,
E.G.
there is a div on Youtube with the ID description, how would i get the contents of that DIV?
Thanx
Sam Rudge
Is there any way to retrieve the contents of a DIV from another website,
E.G.
there is a div on Youtube with the ID description, how would i get the contents of that DIV?
Thanx
Sam Rudge
My Blog, Life and everything that matters to me - SamRudge.co.uk
2x Macbook Pro's, 1x Mac Pro, 1x iMac, 2x Macbook's running Fedora linux - In conclusion, I hate windows =)
2x Macbook Pro's, 1x Mac Pro, 1x iMac, 2x Macbook's running Fedora linux - In conclusion, I hate windows =)
•
•
Join Date: May 2008
Posts: 232
Reputation:
Solved Threads: 19
Sory the info i want 2 get from youtube is in a span not div and the class is description not the id,
Well i think that first post was highly successful and accurate
Sam Rudge
Well i think that first post was highly successful and accurate

Sam Rudge
My Blog, Life and everything that matters to me - SamRudge.co.uk
2x Macbook Pro's, 1x Mac Pro, 1x iMac, 2x Macbook's running Fedora linux - In conclusion, I hate windows =)
2x Macbook Pro's, 1x Mac Pro, 1x iMac, 2x Macbook's running Fedora linux - In conclusion, I hate windows =)
•
•
Join Date: May 2008
Posts: 232
Reputation:
Solved Threads: 19
I want to get the contents of the div and set it as a variable to use in my own script
My Blog, Life and everything that matters to me - SamRudge.co.uk
2x Macbook Pro's, 1x Mac Pro, 1x iMac, 2x Macbook's running Fedora linux - In conclusion, I hate windows =)
2x Macbook Pro's, 1x Mac Pro, 1x iMac, 2x Macbook's running Fedora linux - In conclusion, I hate windows =)
I have not done this yet but I have an idea of how you would need to do it.
First you are going to need to use fopen to open the other page and place the contents of that page into a file for your script to read.
You will then need to search that file for the occurrence of the specific div span element that you are looking for. I hope for your sake that the span you are looking for has a specific name and not just span hehe. Anyways you do the string search find what you are looking for and then slap that into your variable.
Helpful links:
http://us2.php.net/manual/en/function.fopen.php
http://us2.php.net/fread
http://us.php.net/strings
Since I do not know the specifics of what you want to do in terms of finding the term the third link is to all PHP string functions.
First you are going to need to use fopen to open the other page and place the contents of that page into a file for your script to read.
You will then need to search that file for the occurrence of the specific div span element that you are looking for. I hope for your sake that the span you are looking for has a specific name and not just span hehe. Anyways you do the string search find what you are looking for and then slap that into your variable.
Helpful links:
http://us2.php.net/manual/en/function.fopen.php
http://us2.php.net/fread
http://us.php.net/strings
Since I do not know the specifics of what you want to do in terms of finding the term the third link is to all PHP string functions.
A little clarification goes a long way.
•
•
Join Date: May 2008
Posts: 232
Reputation:
Solved Threads: 19
Its OK now, thankyou for your help but i use the google/youtube API and found it much easier than searching and opening
My Blog, Life and everything that matters to me - SamRudge.co.uk
2x Macbook Pro's, 1x Mac Pro, 1x iMac, 2x Macbook's running Fedora linux - In conclusion, I hate windows =)
2x Macbook Pro's, 1x Mac Pro, 1x iMac, 2x Macbook's running Fedora linux - In conclusion, I hate windows =)
![]() |
Similar Threads
- How to center align the whole page? (HTML and CSS)
- AutoScrolling a DIV tag (JavaScript / DHTML / AJAX)
- Hyperlink a div (JavaScript / DHTML / AJAX)
- I need to grab the height of a div. (JavaScript / DHTML / AJAX)
- DIV Help! (HTML and CSS)
- I just can't get this Javascript (JavaScript / DHTML / AJAX)
- update the page without changing it? (Site Layout and Usability)
Other Threads in the PHP Forum
- Previous Thread: Different of www1 and www
- Next Thread: Execute PHP file in the background from html page
| Thread Tools | Search this Thread |
301 access apache api array autocomplete beginner binary broken button cakephp checkbox class cms code compression cron curl data database date display dropdown dropdownlist duplicates dynamic echo email error execution file files folder form forms function functions google href htaccess html htmlspecialchars httppost image include insert integration ip javascript joomla jquery limit link links login mail md5 menu methods mlm multiple mysql oop paypal pdf pdfdownload php phpvotingscript problem query radio random recursion remote script search secure server session sessions sms source space sql subscription syntax system table tutorial update upload url validator variable video virus volume votedown web youtube





