ojsimon Posted December 20, 2007 Share Posted December 20, 2007 Hi is it possible to make a script that allows a user to select a portion of a page and extract the html code. Thank Quote Link to comment Share on other sites More sharing options...
Jessica Posted December 20, 2007 Share Posted December 20, 2007 You could do it in an editor like tinyMCE, by loading the content into it instead of just the page. Otherwise, I don't see how you'd do it. You'd need to use javascript and php for sure, but I don't know what you'd do. Quote Link to comment Share on other sites More sharing options...
ojsimon Posted December 20, 2007 Author Share Posted December 20, 2007 basically what i want is to for a user to be able to enter a site and then highight the area they want and the script to return the html, is this possible? and if so how? Thanks Quote Link to comment Share on other sites More sharing options...
phpSensei Posted December 20, 2007 Share Posted December 20, 2007 Isnt this how PHPBB2's templates work? Quote Link to comment Share on other sites More sharing options...
ojsimon Posted December 20, 2007 Author Share Posted December 20, 2007 sorry i am new to php what are these thanks Quote Link to comment Share on other sites More sharing options...
anon Posted December 20, 2007 Share Posted December 20, 2007 but if they are highlighting the stuff they want, wouldn't it just be plain text? You wouldn't need to bother with retrieving HTML Quote Link to comment Share on other sites More sharing options...
Ninjakreborn Posted December 20, 2007 Share Posted December 20, 2007 Misread, apologies. Ignore my message. I had noticed Anon asking about the web crawler 2 times,and I didn't know it was a different person until after I had responded. Apologies. Quote Link to comment Share on other sites More sharing options...
ojsimon Posted December 20, 2007 Author Share Posted December 20, 2007 sorry selecting the area so maybe dragging something over it Quote Link to comment Share on other sites More sharing options...
Ninjakreborn Posted December 20, 2007 Share Posted December 20, 2007 If you are wanting something like this, you can take a look at wikipedia. go to www.mediawiki.com and download one of there copies of the software. Look behind the coding and work through it to learn how they did the edit feature and view source feature. Also look at syntax highlighting functions inside of php, they may come in handy for you as well. Quote Link to comment Share on other sites More sharing options...
Jessica Posted December 20, 2007 Share Posted December 20, 2007 I'd think you'd have to use some combination of javascript to get the location of their selected text (for example, tinyMCE and other editors do this withint textareas) and then use ajax to submit the locations to PHP, then use CURL to grab the HTML and then strpos to get the substr() of the HTML that you want. (google) Quote Link to comment Share on other sites More sharing options...
ojsimon Posted December 20, 2007 Author Share Posted December 20, 2007 sorry businessman33221 i am not a programmer and do not know what you mean, i have not repeated this question 3 times it must be someone else you were answering. sorry anyway Quote Link to comment Share on other sites More sharing options...
Ninjakreborn Posted December 20, 2007 Share Posted December 20, 2007 No, you didn't. I edited my statement above because of the misunderstanding. Can you explain one more time what you are wanting exactly. Did you mean someone to copy actual text on a site, then when they copy it pull's the xhtml behind what they copied instead of the actual visible text? Quote Link to comment Share on other sites More sharing options...
phpSensei Posted December 20, 2007 Share Posted December 20, 2007 sorry businessman33221 i am not a programmer and do not know what you mean, i have not repeated this question 3 times it must be someone else you were answering. sorry anyway I suggest you forget about doing something this advanced until you actually learn programming. Obviously you arent really comprehending the functions, and steps in doing this. Quote Link to comment Share on other sites More sharing options...
Jessica Posted December 20, 2007 Share Posted December 20, 2007 If you're not a programmer, you're in the wrong forum. If you want someone to do it for you, go to freelancing forum. Quote Link to comment Share on other sites More sharing options...
ojsimon Posted December 20, 2007 Author Share Posted December 20, 2007 hi jesirose could you explain in more detail what i would need to do and how i can learn to do this. i want to learn thanks Quote Link to comment Share on other sites More sharing options...
phpSensei Posted December 20, 2007 Share Posted December 20, 2007 hi jesirose could you explain in more detail what i would need to do and how i can learn to do this. i want to learn thanks Maybe start learning Javascript, and PHP. Quote Link to comment Share on other sites More sharing options...
ojsimon Posted December 20, 2007 Author Share Posted December 20, 2007 what parts should i learn, i know basic php thanks Quote Link to comment Share on other sites More sharing options...
Jessica Posted December 21, 2007 Share Posted December 21, 2007 Google the things I told you to use and learn it. 1. I can't tell you exactly how to do it because I haven't. 2. You will understand it better if you do it yourself. Of course, now I am intrigued and want to do it, but I'm not going to do it for you But on the other hand what use could this have when people can just view the source of the page and get the HTML that way? I mean...why are you trying to do this? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.