waiwai933 Posted November 22, 2008 Share Posted November 22, 2008 I want to fetch data from a website, which I think is easy enough, but here's the tough part. How do I not get that outputted, but instead, strip the first ten lines, the last ten lines, and then output it? You see, the data to be fetched is the source code, so... Sorry if this is a stupid question, but I'm new to PHP. Link to comment https://forums.phpfreaks.com/topic/133737-how-do-you-fetch-and-modify-data/ Share on other sites More sharing options...
trampolinejoe Posted November 22, 2008 Share Posted November 22, 2008 what do you mean you want to fetch data? you mean you want to connect to a db? where do you want to output to? Link to comment https://forums.phpfreaks.com/topic/133737-how-do-you-fetch-and-modify-data/#findComment-695981 Share on other sites More sharing options...
teng84 Posted November 22, 2008 Share Posted November 22, 2008 use file function and get the desired array index you want Link to comment https://forums.phpfreaks.com/topic/133737-how-do-you-fetch-and-modify-data/#findComment-695988 Share on other sites More sharing options...
waiwai933 Posted November 22, 2008 Author Share Posted November 22, 2008 what do you mean you want to fetch data? you mean you want to connect to a db? where do you want to output to? No, there's a webpage I have on a different server that changes, and I need my first webpage to change with it. I just need it to output to the page. Like say if I sent input abcde, and it removed the first character, I would want the page to be example.com/output.php with the text being bcde. use file function and get the desired array index you want I'm sorry? I don't quite understand you. Link to comment https://forums.phpfreaks.com/topic/133737-how-do-you-fetch-and-modify-data/#findComment-696030 Share on other sites More sharing options...
teng84 Posted November 22, 2008 Share Posted November 22, 2008 http://www.php.net/manual/en/function.file.php refer to the manaul.. read the page as an array so you can manipulate the page easier Link to comment https://forums.phpfreaks.com/topic/133737-how-do-you-fetch-and-modify-data/#findComment-696090 Share on other sites More sharing options...
trampolinejoe Posted November 22, 2008 Share Posted November 22, 2008 ok, so, you want a page on one server to mirror the page on the other? and you have access to both servers? and if it changes you want the other to change? and when something changes on it will it have to be live? or will it have to be after the page is refreshed/ posted? myself, i have no idea how to go off the number of lines, but i am sure if you counted the number of characters you would be able to loop through and delete how ever many characters you wanted from the page with much ease. If you want it to update live it might be harder you might need something fancy like ajax. just a idea and i am sure alot of people here could think of a much better way to do it. but perhaps since many others havnt suggested anything i would say try. post all the characters of the page to your new page as a variable --> loop through and append / delete how ever many characters you want from which ever place on the page you want --> echo the newly modified variable to the page in html so that your php page can generate the old page with the modifications that you wanted. Link to comment https://forums.phpfreaks.com/topic/133737-how-do-you-fetch-and-modify-data/#findComment-696097 Share on other sites More sharing options...
waiwai933 Posted November 22, 2008 Author Share Posted November 22, 2008 post all the characters of the page to your new page as a variable --> loop through and append / delete how ever many characters you want from which ever place on the page you want --> echo the newly modified variable to the page in html so that your php page can generate the old page with the modifications that you wanted. This would work. How do I do it? Link to comment https://forums.phpfreaks.com/topic/133737-how-do-you-fetch-and-modify-data/#findComment-696223 Share on other sites More sharing options...
waiwai933 Posted November 22, 2008 Author Share Posted November 22, 2008 *bump* Link to comment https://forums.phpfreaks.com/topic/133737-how-do-you-fetch-and-modify-data/#findComment-696509 Share on other sites More sharing options...
waiwai933 Posted November 22, 2008 Author Share Posted November 22, 2008 anyone? Link to comment https://forums.phpfreaks.com/topic/133737-how-do-you-fetch-and-modify-data/#findComment-696544 Share on other sites More sharing options...
trampolinejoe Posted November 23, 2008 Share Posted November 23, 2008 well, it depends, because you may not be able to actually post across servers I do not know about that. (if it dosnt work it dosnt matter because you could post the script to a db and then tap into it from the other site and withdraw it). if you want to do it my way then, You need to read up about posting variables (if that dosnt working then learn about inserting / selecting from a db) then running through the number of characters you want to cull. what exactly do you want to know? Link to comment https://forums.phpfreaks.com/topic/133737-how-do-you-fetch-and-modify-data/#findComment-696927 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.