CodeIgniter Forums
Perform HTTP Request and save HTML to string - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Perform HTTP Request and save HTML to string (/showthread.php?tid=5992)



Perform HTTP Request and save HTML to string - El Forum - 02-11-2008

[eluser]Dsyfa[/eluser]
Hi,

How do I perform an HTTP request inside a controllers function to an HTML file and then save the HTML in a string for further processing. My HTML file contains a JavaScript code which generates the actual HTML. Here's the HTML file:
Code:
<html>
<head>
    <title>Hello</title>
</head>
<body>
    
</body>
</html>

Does CI have any built-in helpers to do this??

Thanks


Perform HTTP Request and save HTML to string - El Forum - 02-11-2008

[eluser]Sean Murphy[/eluser]
You could use file_get_contents or CURL:
http://us.php.net/file_get_contents
http://us.php.net/manual/en/ref.curl.php


Perform HTTP Request and save HTML to string - El Forum - 02-13-2008

[eluser]Dsyfa[/eluser]
My hoster has disabled both file_get_contents and curl functions. Is there any other way or a hack/workaround perhaps??


Perform HTTP Request and save HTML to string - El Forum - 02-14-2008

[eluser]Sean Murphy[/eluser]
Have hey disabled fopen too? What about fsockopen?