Jump to content

Capture website code and send to PHP


Go to solution Solved by maxxd,

Recommended Posts

Hi. Not too sure how to word this right. I remember once when I was learning how to send javascript variables to PHP, I accidentally sent a capture of the entire index.php.

Ive been trying to find the answer online but I guess im not wording it right. Does anyone know how to do this?

Link to comment
https://forums.phpfreaks.com/topic/295738-capture-website-code-and-send-to-php/
Share on other sites

  • Solution

It sounds like you're looking for information on AJAX. You can send information from JavaScript to php, process it on the server side in php, and return data to your client-side JavaScript. Here's information on using JQuery - it makes AJAX calls easier to deal with.

  • Like 1

Thanks alot, got the ball rolling :)

So incase anyones new and interested too, to capture the dynamic state of the HTML you only need

var x = $("body").html();
alert(x);
			
			

To capture the saved state of a file and send via aJax

 $.ajax({ 
        url: "fileName.php",
        type: "POST",
        dataType: "text",
        success: function(data) {
            alert(data);
        }
    });


I'm not sure how to capture dynamic variables in Javascript though. I suppose it just needs a script to update an array, then send the array that way.

Thanks for the info maxxd
 

Wouldn't this only get the Body section and not the whole page?

var x = $("body").html();
EDIT:

Here's how to get the lot, depending on how much: http://stackoverflow.com/questions/982717/how-do-i-get-the-entire-pages-html-with-jquery

Edited by IThinkMyBrainHurts
  • Like 1
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.