Saturday 25 July 2009

How can I get a web page on the server side using PHP?

I know how to do this in the Microsoft world: I can call the HTTPRequest class to get a page on the server - not on the client. I then want to find the title of the page in the DOM object to put into the new page I'm creating. I'm trying this:





$r = new HTTP_Request('http://www.yahoo.com/');


$r-%26gt;sendRequest();


$page = $r-%26gt;getResponseBody();





However, I'm getting this error:





"Cannot instantiate non-existent class: http_request"





Maybe my web host won't let me use that class. Is there another, easier way to do this?





Thanks.
How can I get a web page on the server side using PHP?
Try checking this page out: http://www.php.net/manual/en/http.httpre...





That error message is probably because there is no "_" in HttpRequest. That page has some functions you can use with the http request class. I've never tried this myself but hopefully this helps.





Note that this class doesn't come with the standard PHP installation and your host probably does not support it.





If you downloaded this script from http://www.daniweb.com/code/snippet616.h... then it might look like


$http_request = new http_request();





$resp = $http_request-%26gt;raw();


echo nl2br($resp);
How can I get a web page on the server side using PHP?
try finding a good script on hotscript.com. I used one from there once.
Reply:the object is...


for IE...


xmlhttp = new ActiveXObject("Microsoft.XMLHttp");





for other browsers...


xmlhttp = new XMLHttpRequest();


.
Reply:Best Answer - Chosen By Voters





http://www.easyhostguide.com lists the top ten web hosting starting at only $2.95/mo


No comments:

Post a Comment