Get FLV file URL from a webpage - php

I want to get FLV file url of the webpage with automation, is it possible? because that site has no autoplay, when i use GetFLV i get the url on when i press play button, i need to get url in php code'automatically, How to do it?

Retrieve the HTML of the page (using a library such as cURL)
Parse the retrieved HTML (using a library such as the PHP DOM)
Extract the relevant URL from the DOM tree
It is possible the URL was generated via JavaScript, in which case you'll also need to run a JS interpreter or close facsimile thereof.
P.S. - remember to check that doing this does not violate the web site's terms of service.

Related

Detect if php script has been requested by <img> parsing

I have a file manager website running and some users said they'd like to be able to embed the image preview page directly into img tags (on forums etc).
Lets take this page as an example: http://push.anukthewolf.com/a/Screenshot_2015-06-03-08-29-03.png
Even though it has an image extension, it's still a html (well, php) page. Could this script somehow detect if its requesting client is a browser parsing an img tag where its url has been used as source?
If that's the case I would output the image directly instead of the website. In every other case, the website should be sent.

Crawl embeded Flash video and render Javascript to obtain final GUI

Now, I am encountering some difficulties when I have to scan or crawl a video URL link. This web page is using the Flash-based technology to embed the video and stream video.
In order to understand more clearly, this is a link example:
http://vnexpress.net/gl/the-gioi/tu-lieu/2012/11/bai-phat-bieu-thua-nhan-that-bai-cua-romney/
The above link has below content (HTML code for Flash embedded video):
<div id="flashContent" style="text-align:center;width:100%;">
<span id="FlashPlayer79237" class="Normal" align="center">Bạn cần cài Flash Player để xem được Clip này.</span>
</div>
In this above article, there is a above video. However, when I tried to scan or crawl the content, the video could not run properly (because it could not load correct video link) and only show Install Flash Player plugin words (Certainly, the real web page needs to run some Javascript script or Flash script to obtain the real video link and stream this video for users)
Therefore, how can I render Flash and Javascript script through PHP or ASP.NET or Java? How can I get the correct video link when I crawl the web page? In this case, how can I obtain the correct Flash embedded video (HTML code)?
Thank you so much.
Before I answer, I want to make a note that if you need this information to do anything shady... please don't.
Disclaimer aside, for that particular site it is relatively easy.
The flashvars param (which is probably put there by Javascript) contains a value called xmlPath, which is a url encoded path (relative to their domain name). If you grab that and decode it, you get something like:
/Service/FlashVideo/PlayListVideoPage.asp?id=79237&f=108&t=1
which points to
http://vnexpress.net/Service/FlashVideo/PlayListVideoPage.asp?id=79237&f=108&t=1
If you read that, it's an XML file which contains the URL of the actual video.
I'm not quite sure where that value is generated from. If you needed to do this fully server-side, you could use a headless browser to process it.

How to load javascript contents using php?

How to load javascript contents using php. Suppose when php saves a file using, file get contents and file put contents, JavaScript contents like Google current ads is never loaded but the google adsense codes are loaded.
Can php "run" the JavaScript code on a saved page in order to save the dynamic content that the code generates?
Already got the answer is NO.
Is there any way or no Way?
You are asking whether or not PHP can "run" the JavaScript code on a saved page in order to save the dynamic content that the code generates. The answer is no, it cannot. Or at least, not without building your own JavaScript interpreter.

PHP Using imagegrabscreen

How could I use imagegrabscreen to get a thumbnail image and a full size image of a specific website.
I was thinking that I could have an array that I feed the wanted uri's into but I am a bit stuck on how I would set the wxh of the image I need to grab. I also think that I would need a thumbnail class and a fullimage class and call them when required.
Any better Ideas?
Keep in mind that imagaegrabscreen is Windows-only. If you have multiple displays set up, this function will only grab the primary display. Also, for this to work, your Apache service must be set to Allow service to interact with desktop otherwise you will just get a blank image.
This discussion covers the use of imagegrabscreen pretty well: Getting imagegrabscreen to work
There are a lot of other discussions about saving webpages as images, too - here are a few:
Website screenshots
Web Page Screenshots with PHP?
How can I generate a screenshot of a webpage using a server-side script?
PHP: How to capture browser window screen with php?
What is the best way to create a web page thumbnail?
Screenshot of current page using PHP
shell tool which renders web site including javascript
In any languages, Can I capture a webpage and save it image file? (no install, no activeX)

Download all images from a single webpage

I'm experimenting with PHP, and I've just asked myself a question. How can I download all images from a single website? Let's say that I wanted and images from cnn.com or any other website. Is there any easy way I can download all the images using PHP, and save them on my local computer (or FTP server).
Any help would be appreciated.
Not very easy, but not that hard:
Request the page using Curl, parse the HTML using DOMXpath and look for the src attributes of the images. Then download the images via Curl by adding the full http address to the image path/name.
If you wanted just all download all images referenced by img elements.
Request the remote file with something like cURL.
Use a DOM parser (such as DOMDocument) to get all img element.
Iterate over the img elements and use cURL (or similar) to download each image (check the src attribute).

Categories