![]() |
![]() |
![]() |
||||
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. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
BANNED
Industry Role:
Join Date: Oct 2004
Location: In Your Head
Posts: 25,142
|
![]() 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 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 | |
►SouthOfHeaven
Join Date: Jun 2004
Location: PlanetEarth MyBoardRank: GerbilMaster My-Penis-Size: extralarge MyWeapon: Computer
Posts: 28,609
|
Quote:
__________________
hatisblack at yahoo.com |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
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? |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 | |
see you later, I'm gone
Industry Role:
Join Date: Oct 2002
Posts: 14,091
|
Quote:
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! |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 | |
►SouthOfHeaven
Join Date: Jun 2004
Location: PlanetEarth MyBoardRank: GerbilMaster My-Penis-Size: extralarge MyWeapon: Computer
Posts: 28,609
|
Quote:
__________________
hatisblack at yahoo.com |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 |
♥♥♥ Likes Hugs ♥♥♥
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. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 |
►SouthOfHeaven
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 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 | ||
Confirmed User
Join Date: Oct 2002
Posts: 3,745
|
Quote:
Quote:
__________________
For historical display only. This information is not current: support@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 |
||
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 |
►SouthOfHeaven
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 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 | ||
Confirmed User
Join Date: Oct 2002
Posts: 3,745
|
Quote:
The relative path is less likely to break when you move servers. Quote:
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. 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@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 |
||
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#11 |
Confirmed User
Join Date: Oct 2002
Posts: 3,745
|
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@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 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#12 |
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. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#13 | |
see you later, I'm gone
Industry Role:
Join Date: Oct 2002
Posts: 14,091
|
Quote:
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! |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#14 | |
So Fucking Banned
Industry Role:
Join Date: Apr 2009
Posts: 2,968
|
Quote:
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. |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#15 | |
see you later, I'm gone
Industry Role:
Join Date: Oct 2002
Posts: 14,091
|
Quote:
curl_setopt($curl_handle, CURLOPT_POST, 1); curl_setopt($curl_handle, CURLOPT_POSTFIELDS,"var=whatever&var1=whatever&var 2=whatever);
__________________
All cookies cleared! |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#16 |
►SouthOfHeaven
Join Date: Jun 2004
Location: PlanetEarth MyBoardRank: GerbilMaster My-Penis-Size: extralarge MyWeapon: Computer
Posts: 28,609
|
icq me or post variables and xml url
__________________
hatisblack at yahoo.com |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#17 | |
Confirmed User
Join Date: Oct 2002
Posts: 3,745
|
Quote:
![]() 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. |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#18 |
So Fucking Banned
Industry Role:
Join Date: Apr 2009
Posts: 2,968
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#19 |
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! |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#20 |
Bollocks
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.
__________________
Interserver unmanaged AMD Ryzen servers from $73.00 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#21 |
BANNED
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 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#22 | |
BANNED
Industry Role:
Join Date: Oct 2004
Location: In Your Head
Posts: 25,142
|
Quote:
It works anyway.
__________________
. Yes, fewer illegal immigrants working equates to more job opportunities for American citizens. Rochard |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#23 | |
there's no $$$ in porn
Industry Role:
Join Date: Jul 2005
Location: icq: 195./568.-230 (btw: not getting offline msgs)
Posts: 33,063
|
Quote:
Using php short tags can also cause problems when using xml directives. |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#24 |
►SouthOfHeaven
Join Date: Jun 2004
Location: PlanetEarth MyBoardRank: GerbilMaster My-Penis-Size: extralarge MyWeapon: Computer
Posts: 28,609
|
grammatical errors. i made it simple. it works , there are no security concerns.
__________________
hatisblack at yahoo.com |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#25 |
So Fucking Banned
Industry Role:
Join Date: Apr 2009
Posts: 2,968
|
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? ![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |