Capture Page with PHP Curl

Asked

Viewed 488 times

0

People need to capture the source code of a page with Curl, but the jQuery of this page that generates the content and Curl does not return this data generated with jQuery, is there any way to capture the source code of the page after it is already rendered with jQuery working? I am using PHP.

  • 1

    There is no way, what can do and try to take the data from jQuery and bring to PHP. Another solution, if jQuery loads an external page is to just do the Curl on this page by loading the native cookies/headers. The solution you want will need to use a Webdriver, a native browser that will open the page and collect the data, but it will be immensely heavier and more complicated than Curl.

  • I’ll explain @Inkeliz: I have a calendar plugin in jquery (zabuto_calendar) that generates a calendar and I need to take this page and turn it into pdf. I am using mpdf, already tried with dompdf too, but in both loads only html and css but jquery does not load. I am not finding a solution.

  • Never heard of this zabuto_calendar, but seeing the documentation he owns it: $("#my-calendar").zabuto_calendar( { ajax: { url: "{YOUR_URL}" } } or $("#my-calendar").zabuto_calendar( { data: [] } );. Then take the data (if this is the first case, enter the ajax url to load). Then you will have the data. Create an HTML/CSS table (without javascript), processed by PHP, and replace in the main HTML of Curl, for example by making a replace in the <div id="my-calendar"></div>. This way you will have the data replaced.

  • you need the full page or only the data loaded via ajax by the page you want to "record"? If it is only to get the data generated by ajax (sent by jquery), just read directly the url you require via ajax.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.