Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar Mark Forums Read
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 12-03-2011, 06:29 PM   #1
TheSquealer
BANNED
 
TheSquealer's Avatar
 
Industry Role:
Join Date: Oct 2004
Location: In Your Head
Posts: 25,142
Simple PHP Include Question... Help Please

in this file:
http://www.domain-one.com/folderone/...lename-one.php

I want to use PHP to include a file located here:
http://www.domain-two.com/folderone/...lename-two.php

I can't seem to get it to work.

I've been looking around for answers and there seems to be a few different ways to do it and I can't get any to work

Help!?
__________________
.
Yes, fewer illegal immigrants working equates to more job opportunities for American citizens.

Rochard
TheSquealer is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-03-2011, 06:34 PM   #2
SmokeyTheBear
►SouthOfHeaven
 
SmokeyTheBear's Avatar
 
Join Date: Jun 2004
Location: PlanetEarth MyBoardRank: GerbilMaster My-Penis-Size: extralarge MyWeapon: Computer
Posts: 28,609
Quote:
Originally Posted by TheSquealer View Post
in this file:
http://www.domain-one.com/folderone/...lename-one.php

I want to use PHP to include a file located here:
http://www.domain-two.com/folderone/...lename-two.php

I can't seem to get it to work.

I've been looking around for answers and there seems to be a few different ways to do it and I can't get any to work

Help!?
<?@readfile("http://www.domain-two.com/folderone/foldertwo/filename-two.php");?>
__________________
hatisblack at yahoo.com
SmokeyTheBear is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-03-2011, 06:41 PM   #3
cam_girls
So Fucking Banned
 
Industry Role:
Join Date: Apr 2009
Posts: 2,968
I can't see the files,

but the file you read in should just be some functions, no < H T M L > or < ? p h p

just like you copied and pasted it into the main file.

include 'http://site.com/secondfile.php'

should work!

Do a test, copy the 2nd file into your main file - same error message?
cam_girls is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-03-2011, 06:51 PM   #4
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,091
Quote:
Originally Posted by TheSquealer View Post
in this file:
http://www.domain-one.com/folderone/...lename-one.php

I want to use PHP to include a file located here:
http://www.domain-two.com/folderone/...lename-two.php

I can't seem to get it to work.

I've been looking around for answers and there seems to be a few different ways to do it and I can't get any to work

Help!?
Are the domains on the same server or different servers? Also, Nix or Win?

If they are on the same server then include the file from domain 2 using the full path to the file, not the url.

If they are not on the same server then if you are on win you cannot use include to pull it in, if you are on nix you can use include using the url if allow_url_include is set to true in your php.ini file.


.
__________________
All cookies cleared!
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-03-2011, 06:51 PM   #5
SmokeyTheBear
►SouthOfHeaven
 
SmokeyTheBear's Avatar
 
Join Date: Jun 2004
Location: PlanetEarth MyBoardRank: GerbilMaster My-Penis-Size: extralarge MyWeapon: Computer
Posts: 28,609
Quote:
Originally Posted by cam_girls View Post
I can't see the files,

but the file you read in should just be some functions, no < H T M L > or < ? p h p

just like you copied and pasted it into the main file.

include 'http://site.com/secondfile.php'

should work!

Do a test, copy the 2nd file into your main file - same error message?
huh ?....
__________________
hatisblack at yahoo.com
SmokeyTheBear is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-03-2011, 06:53 PM   #6
Babaganoosh
♥♥♥ Likes Hugs ♥♥♥
 
Babaganoosh's Avatar
 
Industry Role:
Join Date: Nov 2001
Location: /home
Posts: 15,841
If allow_url_fopen is disabled on your server you won't be able to do it in php.
__________________
I like pie.
Babaganoosh is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-03-2011, 07:00 PM   #7
SmokeyTheBear
►SouthOfHeaven
 
SmokeyTheBear's Avatar
 
Join Date: Jun 2004
Location: PlanetEarth MyBoardRank: GerbilMaster My-Penis-Size: extralarge MyWeapon: Computer
Posts: 28,609
<?php
$curl_handle=curl_init();
curl_setopt($curl_handle,CURLOPT_URL,'http://example.com/folder/file.html');
curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1) ;
$buffer = curl_exec($curl_handle);
curl_close($curl_handle);
echo $buffer;
?>
__________________
hatisblack at yahoo.com
SmokeyTheBear is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-03-2011, 07:21 PM   #8
raymor
Confirmed User
 
Join Date: Oct 2002
Posts: 3,745
Quote:
Originally Posted by sarettah View Post
If they are on the same server then include the file from domain 2 using the full path to the file, not the url.
Do that. If using the URL works, your server admin fucked up and if the server had been live for more than 48 hours it's probably hacked by now.

Quote:
Code:
<?@readfile("http://www.domain-two.com/folderone/foldertwo/filename-two.php");?>
That's about par for the course with PHP code - three errors in one line. Do not use that.
__________________
For historical display only. This information is not current:
support&#64;bettercgi.com ICQ 7208627
Strongbox - The next generation in site security
Throttlebox - The next generation in bandwidth control
Clonebox - Backup and disaster recovery on steroids
raymor is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-03-2011, 07:29 PM   #9
SmokeyTheBear
►SouthOfHeaven
 
SmokeyTheBear's Avatar
 
Join Date: Jun 2004
Location: PlanetEarth MyBoardRank: GerbilMaster My-Penis-Size: extralarge MyWeapon: Computer
Posts: 28,609
at the very least post something. my suggestions both work.. what you have posted does not
__________________
hatisblack at yahoo.com
SmokeyTheBear is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-03-2011, 07:36 PM   #10
raymor
Confirmed User
 
Join Date: Oct 2002
Posts: 3,745
Quote:
Originally Posted by sarettah View Post
Are the domains on the same server or different servers? Also, Nix or Win?

If they are on the same server then include the file from domain 2 using the full path to the file, not the url.
Do that. Use the path, not the URL. Full path or relative path is OK.
The relative path is less likely to break when you move servers.

Quote:
if you are on nix you can use include using the url if allow_url_include is set to true in your php.ini file.
allow_url_include requires allow_url_fopen.
allow_url_fopen requires stupid.
Therefore include(url) requires being stupid.

Use SmokeyTheBear's cURL code if they are on different servers. Be aware that's not like a PHP include, as you're getting the OUTPUT of the remote PHP script, not it's contents.


Quote:
Originally Posted by SmokeyTheBear View Post
<?@readfile("http://www.domain-two.com/folderone/foldertwo/filename-two.php");?>
Smokey was right on the cURL code, but this line is typical for PHP code. Typical because it has three errors in one line of code.
__________________
For historical display only. This information is not current:
support&#64;bettercgi.com ICQ 7208627
Strongbox - The next generation in site security
Throttlebox - The next generation in bandwidth control
Clonebox - Backup and disaster recovery on steroids
raymor is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-03-2011, 08:26 PM   #11
raymor
Confirmed User
 
Join Date: Oct 2002
Posts: 3,745
Quote:
Originally Posted by SmokeyTheBear View Post
at the very least post something. my suggestions both work.. what you have posted does not
My post was submitted before it was complete. Sorry about that. I meant to at least acknowledge that your cURL code looks good (though I didn't heavily analyze it).
__________________
For historical display only. This information is not current:
support&#64;bettercgi.com ICQ 7208627
Strongbox - The next generation in site security
Throttlebox - The next generation in bandwidth control
Clonebox - Backup and disaster recovery on steroids
raymor is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-03-2011, 08:31 PM   #12
raymor
Confirmed User
 
Join Date: Oct 2002
Posts: 3,745
Btw be very, very careful if there are any variables in the path or especially a URL. The bad guys can be very tricky about sneaking stuff into variables so you end up executing whatever they put at http://hacker.com/yourfucked.php?you.com/yourscript.php

Also you said "it doesn't work". What does the error log tell you about WHY it didn't work? When you say "it doesn't work", the second half of that sentence is the important part - it doesn't work and the error log says that's because ...

The very important message in the error log assumes you don't prefix the statement with "@" as you sometimes see people do. "@" means "when this fails don't tell me why and don't stop processing, just keep going as pretending it worked, without telling me what's wrong". It could be useful if you know that the statement is SUPPOSED to fail sometimes.

Last edited by raymor; 12-03-2011 at 08:36 PM..
raymor is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-03-2011, 09:10 PM   #13
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,091
Quote:
Originally Posted by raymor View Post
allow_url_include requires allow_url_fopen.
allow_url_fopen requires stupid.
Therefore include(url) requires being stupid.

Use SmokeyTheBear's cURL code if they are on different servers. Be aware that's not like a PHP include, as you're getting the OUTPUT of the remote PHP script, not it's contents.
I was only trying to tell the guy where his issue may lie, not making reccomendations.

Myself, unless I have control of the file I am pulling in, or it is on an extremely trusted site, I'm not pulling it in or pushing it out.

If I had this issue, on 2 different servers, with domains I control, I would probably just duplicate the file from server 1 on server 2. If the file was dynamic then I would use a curl solution like Smokey's.

but that just me.
__________________
All cookies cleared!
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-03-2011, 09:13 PM   #14
cam_girls
So Fucking Banned
 
Industry Role:
Join Date: Apr 2009
Posts: 2,968
Quote:
Originally Posted by SmokeyTheBear View Post
<?php
$curl_handle=curl_init();
curl_setopt($curl_handle,CURLOPT_URL,'http://example.com/folder/file.html');
curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1) ;
$buffer = curl_exec($curl_handle);
curl_close($curl_handle);
echo $buffer;
?>

Smokey can you help me with a script that uses $curl to send an XML request with POST?

I need to read the XML stats and populate my Aff Program tables.
cam_girls is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-03-2011, 09:35 PM   #15
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,091
Quote:
Originally Posted by cam_girls View Post
Smokey can you help me with a script that uses $curl to send an XML request with POST?

I need to read the XML stats and populate my Aff Program tables.
add curlopt_post and the curlopt_postfields to what smokey did.

curl_setopt($curl_handle, CURLOPT_POST, 1);
curl_setopt($curl_handle, CURLOPT_POSTFIELDS,"var=whatever&var1=whatever&var 2=whatever);
__________________
All cookies cleared!
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-03-2011, 09:48 PM   #16
SmokeyTheBear
►SouthOfHeaven
 
SmokeyTheBear's Avatar
 
Join Date: Jun 2004
Location: PlanetEarth MyBoardRank: GerbilMaster My-Penis-Size: extralarge MyWeapon: Computer
Posts: 28,609
Quote:
Originally Posted by cam_girls View Post
Smokey can you help me with a script that uses $curl to send an XML request with POST?

I need to read the XML stats and populate my Aff Program tables.
icq me or post variables and xml url
__________________
hatisblack at yahoo.com
SmokeyTheBear is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-03-2011, 09:56 PM   #17
raymor
Confirmed User
 
Join Date: Oct 2002
Posts: 3,745
Quote:
Originally Posted by sarettah View Post
I was only trying to tell the guy where his issue may lie, not making reccomendations.

Myself, unless I have control of the file I am pulling in, or it is on an extremely trusted site, I'm not pulling it in or pushing it out.

If I had this issue, on 2 different servers, with domains I control, I would probably just duplicate the file from server 1 on server 2. If the file was dynamic then I would use a curl solution like Smokey's.

but that just me.
:

Since I've called allow_fopen_url "stupid", I should acknowledge that I've written stupid code. A lot of what I've learned I didn't learn from a book, but from doing stupid. Heck, most of what I write wouldn't make it into the kernel, Linus would call it stupid. So my comment is only that the function should be avoided and shouldn't be interpreted as a slam on PEOPLE who use it.

Last edited by raymor; 12-03-2011 at 10:00 PM..
raymor is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-03-2011, 10:15 PM   #18
cam_girls
So Fucking Banned
 
Industry Role:
Join Date: Apr 2009
Posts: 2,968
Quote:
Originally Posted by SmokeyTheBear View Post
icq me or post variables and xml url

Thanks! I'm setting up the server today so I'll get what I can on there first so you can have a look.
cam_girls is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-04-2011, 04:09 PM   #19
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,091
Know what I love about threads like this?

Guy comes in and asks a question.

4 different programmers and cam_girls come in and offer up solutions, reccomendations and what not and there is no trace of the original poster.

Glad cam_girls got his hook up with smokey though. At least someone got something from the conversation.

Makes ya wonder, ya know?



.
__________________
All cookies cleared!
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-04-2011, 04:42 PM   #20
redwhiteandblue
Bollocks
 
redwhiteandblue's Avatar
 
Industry Role:
Join Date: Jun 2007
Location: Bollocks
Posts: 2,792
I bet none of the above solutions will work anyway because the OP probably wants to include the source file not the output file.
redwhiteandblue is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-05-2011, 06:41 AM   #21
TheSquealer
BANNED
 
TheSquealer's Avatar
 
Industry Role:
Join Date: Oct 2004
Location: In Your Head
Posts: 25,142
I want to thank everyone for their suggestions. I am going to keep playing with this today and try all the solutions. I know there are security concerns as well, which adds a bit to the mind fuck of what I thought was a simple thing.
__________________
.
Yes, fewer illegal immigrants working equates to more job opportunities for American citizens.

Rochard
TheSquealer is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-05-2011, 07:01 AM   #22
TheSquealer
BANNED
 
TheSquealer's Avatar
 
Industry Role:
Join Date: Oct 2004
Location: In Your Head
Posts: 25,142
Quote:
<?@readfile("http://www.domain-two.com/folderone/foldertwo/filename-two.php");?>
Is there a reason not to do this? What are the errors?

It works anyway.
__________________
.
Yes, fewer illegal immigrants working equates to more job opportunities for American citizens.

Rochard
TheSquealer is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-05-2011, 07:12 AM   #23
u-Bob
there's no $$$ in porn
 
u-Bob's Avatar
 
Industry Role:
Join Date: Jul 2005
Location: icq: 195./568.-230 (btw: not getting offline msgs)
Posts: 33,063
Quote:
Originally Posted by TheSquealer View Post
Is there a reason not to do this? What are the errors?

It works anyway.
Short open tags don't work on all servers (got to set short_open_tag to On in php.ini) so the script isn't as portable as it should be (might dump php code to the surfers browser...)
Using php short tags can also cause problems when using xml directives.
u-Bob is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-05-2011, 09:55 AM   #24
SmokeyTheBear
►SouthOfHeaven
 
SmokeyTheBear's Avatar
 
Join Date: Jun 2004
Location: PlanetEarth MyBoardRank: GerbilMaster My-Penis-Size: extralarge MyWeapon: Computer
Posts: 28,609
Quote:
Originally Posted by TheSquealer View Post
Is there a reason not to do this? What are the errors?

It works anyway.
grammatical errors. i made it simple. it works , there are no security concerns.
__________________
hatisblack at yahoo.com
SmokeyTheBear is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-05-2011, 02:45 PM   #25
cam_girls
So Fucking Banned
 
Industry Role:
Join Date: Apr 2009
Posts: 2,968
Quote:
Originally Posted by SmokeyTheBear View Post
icq me or post variables and xml url
I found a script to send a XML POST request but this is all it does.

http://camaffiliate.com/chron_get_xml_2.php
400 Bad Request


http://camaffiliate.com/chron_get_xml_2.txt

Can you see the problem?
cam_girls is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks
Thread Tools



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.