Reply LinkBack Thread Tools Search this Thread
Old 24-03-2008, 12:18   #1 (permalink)
sand007
Registered User
 
Join Date: May 2007
Posts: 11
PHP Help! include url without changing allow_url_include to "on"

Hello.

I would like to include one of my wordress page on static page.
However, allow_url_include is off on the php ini setting and I don't have authority to change these settings. By the way I am using PHP 5.2.3.

I research about this and found two possible clues.


Code:
$_GET['page_id'] = '3'; include_once ($_SERVER['DOCUMENT_ROOT']."wordpress/index.php");



But I have to put $_GET['page_id'] on destination page, and I don't know how this will work when it comes to wordpress.

Second one is using curl. I found this function in another forum and it works.

Code:
function get_content($url) { $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_HEADER, 0); ob_start(); curl_exec ($ch); curl_close ($ch); $string = ob_get_contents(); ob_end_clean(); return $string; } $content = get_content ("http://yoursite.com/wordpress/?page_id=3"); echo ($content);

I am not programmer and I don't know about web security well. I heard that allow_url_include is off on default setting because there are security issue. How about method above? Is this secure to do? or is there any better way to do this?
  Reply With Quote
Old 24-03-2008, 13:22   #2 (permalink)
pgo
Moderator
 
pgo's Avatar
 
Join Date: Jan 2005
Location: Brooklyn, NYC
Posts: 11,869
What are you trying to achieve, exactly?

"I would like to include one of my wordress page on static page." is vague and practically meaningless.
__________________
  Reply With Quote
Old 24-03-2008, 13:31   #3 (permalink)
sand007
Registered User
 
Join Date: May 2007
Posts: 11
Sorry, my question was not clear.
I would like to know the code below is secure or not.

Code:
function get_content($url) { $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_HEADER, 0); ob_start(); curl_exec ($ch); curl_close ($ch); $string = ob_get_contents(); ob_end_clean(); return $string; } $content = get_content ("http://yoursite.com/wordpress/?page_id=3"); echo ($content);
  Reply With Quote
Old 25-03-2008, 16:29   #4 (permalink)
hobolooter
Registered User
 
hobolooter's Avatar
 
Join Date: Feb 2004
Location: USA
Posts: 48
Send a message via AIM to hobolooter
It's not taking any user input and is interpreted on the server side. Looks about as secure as you are gonna get it.
  Reply With Quote
Old 30-03-2008, 11:52   #5 (permalink)
bluesage
Senior Member
 
Join Date: Dec 2006
Location: Switzerland
Posts: 276
you could always use an iframe, although its not the most accepted method out there.
__________________
www.benshu.ch // Evolving with Style

  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8