Jump to content

challenge with my friend, help me :)


ksupport

Recommended Posts

I got a challenge with my friend about uploading a file to a remote host behind proxies. He said, it is not possible at all in PHP. and he said, It can be done in Ruby. I know PHP only.

 

I need to upload a Kfile.txt to a remote site.. ex, www.somexamplesite.com/upload.html

 

upload.html has a form with action => upload.php

file field name is "localfile"

 

I got GET method idea.,

$fp = @fsockopen("tcp://".$host,$i,$errno,$errstr,10);
if($fp)
{
@fputs($fp,"GET http://www.remotesite.tld/upload HTTP/1.1\r\nHost:www.domainhost.tld\r\n\r\n");
}

 

I have no clue about post method with files.

 

I am new to phpfreaks but not to php. I hope some php guru may know it.

Link to comment
https://forums.phpfreaks.com/topic/83492-challenge-with-my-friend-help-me/
Share on other sites

It can, in theory, be done with cURL. In practice, you might run into issues. I can't remember the specifics, but people do have some problems with the file upload via cURL. If you google 'php cURL file upload' or whatever, you should find some examples and a better explanation of the problems you might have.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.