twitter




Saturday, October 24, 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%26#039;m creating. I%26#039;m trying this:



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



$r-%26gt;sendRequest();



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



However, I%26#039;m getting this error:



%26quot;Cannot instantiate non-existent class: http_request%26quot;



Maybe my web host won%26#039;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 %26quot;_%26quot; in HttpRequest. That page has some functions you can use with the http request class. I%26#039;ve never tried this myself but hopefully this helps.



Note that this class doesn%26#039;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.



Other Replys:the object is...



for IE...



xmlhttp = new ActiveXObject(%26quot;Microsoft.XMLHttp%26quot;);



for other browsers...



xmlhttp = new XMLHttpRequest();



.



Other Replys: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