1

I have an website that loads an iframe through javacsript, now i want to fetch the content of the iframe in my php cron job how can i do that?

i already tried a few things like puphpeteer and jonnyw/php-phantomJS but both do not work with laravel 9.45.0

w3_
  • 64
  • 1
  • 1
  • 14
  • an iframe is an HTML page inside another one. if u need to obtain the source of that iframe, is just an HTML document. In php, use [an HTTP](https://docs.guzzlephp.org/en/stable/quickstart.html) client to fetch it via it's URL – ericmp Dec 21 '22 at 14:26
  • 1
    You're going to need the URL of the webpage inside the iframe, after that it's as easy as "getting the file contents" of the URL. A way to approach this would be to use javascript to call the phpscript by passing the URL of the iframe to it, and the PHP script would get the contents of that URL to be used – Moudi Dec 21 '22 at 14:28
  • I know it's been a few months, would love to hear if you came up with another solution. Workarounds for abandoned packages will only work so long. nesk/puphpeteer has been abandoned but I was able to make it work with help here: https://stackoverflow.com/questions/75340505/puphpeteer-php-bridge-package-unable-to-install-on-laravel-9 – dfeva Mar 17 '23 at 01:32
  • @dfeva hey, havnt been on stackoverflow last few weeks but ill take a look how i fixed it! – w3_ Jun 08 '23 at 15:38

0 Answers0