boo_lolly Posted December 4, 2007 Share Posted December 4, 2007 i was wondering if curl can be used to fetch the source code in the form of a string from a remote page. and if so, how do i use it? the reason why i'm asking is because i'm working on a site for a client that rents out a beachhouse. they are using a web application called jac built with cakephp to manage their booked dates and whatnot. i want to put a teaser calendar on their website that shows the current month calendar, with the available and unavailable dates. it doesn't look like i can do this without inserting an iframe, and then i run into the never-ending browser support issue, which is what i'm trying to avoid. so i figured to fetch the html and modify it just a little and print the html into the site. communicating with the API i think is far too much work, unless you guys have found an easier way. so I'm just looking for alternatives, not just cURL info. any help? Quote Link to comment Share on other sites More sharing options...
btherl Posted December 4, 2007 Share Posted December 4, 2007 If by "source code" you mean the html output from a php script, then the answer is yes. You can fetch it with curl as a string and print it out, and it can be used to achieve what you would achieve with an iframe. Keep in mind that any delay in fetching the calendar will affect load times for the entire page. Quote Link to comment Share on other sites More sharing options...
boo_lolly Posted December 4, 2007 Author Share Posted December 4, 2007 thank you btherl. so how would i go about retrieving the html output that goes to the browser using cURL? any suggestions or snippets? Quote Link to comment Share on other sites More sharing options...
btherl Posted December 4, 2007 Share Posted December 4, 2007 Here's a tutorial which has the basic curl example: http://www.higherpass.com/php/Tutorials/Using-Curl-To-Query-Remote-Servers/ Usually you'll want to switch header off and returntransfer on if you want to capture the response and process it. 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.