Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.