Include a external http://url?var=val into a php page

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
pchang
Forum Newbie
Posts: 2
Joined: Fri Jan 23, 2009 5:34 pm

Include a external http://url?var=val into a php page

Post by pchang »

How can I include this

http://74.125.19.101/translate_c?hl=en& ... eFwoSerr6Q

in a secure way without having to have the allow_url_fopen = on in the php.ini file so I can avoid cross-site-scripting (xss) attacks.
Currently I have the allow_url_fopen = off and I get this error message

Warning: require_once() [function.require-once]: URL file-access is disabled in the server configuration in /home/channcom/public_html/changdesign.com/cnn.php on line 10

Warning: require_once(http://74.125.19.101/translate_c?hl=en& ... FnxkVB23LA) [function.require-once]: failed to open stream: no suitable wrapper could be found in /home/channcom/public_html/changdesign.com/cnn.php on line 10

Fatal error: require_once() [function.require]: Failed opening required 'http://74.125.19.101/translate_c?hl=en& ... FnxkVB23LA' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/channcom/public_html/changdesign.com/cnn.php on line 10

I look around everywhere but have not found anything :banghead:

link http://www1.changdesign.com/cnn.php

code I use so far

<?php require_once('http://74.125.19.101/translate_c?hl=en& ... FnxkVB23LA'); ?>


before hand thank you for your help
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Include a external http://url?var=val into a php page

Post by requinix »

That page sure doesn't look like a PHP page. So why are you trying to use a function that's meant exclusively for including PHP pages?

I'm pretty sure this will work better than what you're trying.
pchang
Forum Newbie
Posts: 2
Joined: Fri Jan 23, 2009 5:34 pm

Re: Include a external http://url?var=val into a php page

Post by pchang »

Any suggestions on how I should write the code?
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Include a external http://url?var=val into a php page

Post by requinix »

Not really. The function is pretty self-explanatory.
Post Reply