Discussion:
Sending a file to a plugin via XMLRPC?
David Anderson
2013-09-17 15:39:07 UTC
Permalink
Hi,

Has anyone ever written code to send a file, in chunks, from one WP
install to another, using XMLRPC? That's a task I've got to work on soon
- but I don't want to re-invent the wheel.

My plugin code will be installed at both ends.

The files are potentially very large. Basically, the sending end needs
to be able to:
a) See how much of the file is already uploaded ("oy, how much of this
file have you already got?")
b) Send the next chunk, in a loop ("here's a chunk - thanks - here's a
chunk - thanks ...")

Many thanks,
David
--
WordShell - WordPress fast from the CLI - www.wordshell.net
Martin Lazarov
2013-09-17 15:51:51 UTC
Permalink
If you host this file somewhere you can just send link to the plugin
and using curl to download the remote file from the plugin.
Hi,
Has anyone ever written code to send a file, in chunks, from one WP install
to another, using XMLRPC? That's a task I've got to work on soon - but I
don't want to re-invent the wheel.
My plugin code will be installed at both ends.
The files are potentially very large. Basically, the sending end needs to be
a) See how much of the file is already uploaded ("oy, how much of this file
have you already got?")
b) Send the next chunk, in a loop ("here's a chunk - thanks - here's a chunk
- thanks ...")
Many thanks,
David
--
WordShell - WordPress fast from the CLI - www.wordshell.net
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
Abdussamad Abdurrazzaq
2013-09-17 18:09:37 UTC
Permalink
Don't use curl directly. Use wp_remote_get.
Post by Martin Lazarov
If you host this file somewhere you can just send link to the plugin
and using curl to download the remote file from the plugin.
Hi,
Has anyone ever written code to send a file, in chunks, from one WP install
to another, using XMLRPC? That's a task I've got to work on soon - but I
don't want to re-invent the wheel.
My plugin code will be installed at both ends.
The files are potentially very large. Basically, the sending end needs to be
a) See how much of the file is already uploaded ("oy, how much of this file
have you already got?")
b) Send the next chunk, in a loop ("here's a chunk - thanks - here's a chunk
- thanks ...")
Many thanks,
David
--
WordShell - WordPress fast from the CLI - www.wordshell.net
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
Jesse Friedman
2013-09-17 18:37:52 UTC
Permalink
I haven't but, I have seen JSON used to do it.


On Tue, Sep 17, 2013 at 2:09 PM, Abdussamad Abdurrazzaq <
Post by Abdussamad Abdurrazzaq
Don't use curl directly. Use wp_remote_get.
Post by Martin Lazarov
If you host this file somewhere you can just send link to the plugin
and using curl to download the remote file from the plugin.
Hi,
Has anyone ever written code to send a file, in chunks, from one WP install
to another, using XMLRPC? That's a task I've got to work on soon - but I
don't want to re-invent the wheel.
My plugin code will be installed at both ends.
The files are potentially very large. Basically, the sending end needs to be
a) See how much of the file is already uploaded ("oy, how much of this file
have you already got?")
b) Send the next chunk, in a loop ("here's a chunk - thanks - here's a chunk
- thanks ...")
Many thanks,
David
--
WordShell - WordPress fast from the CLI - www.wordshell.net
______________________________**_________________
wp-hackers mailing list
http://lists.automattic.com/**mailman/listinfo/wp-hackers<http://lists.automattic.com/mailman/listinfo/wp-hackers>
______________________________**_________________
wp-hackers mailing list
http://lists.automattic.com/**mailman/listinfo/wp-hackers<http://lists.automattic.com/mailman/listinfo/wp-hackers>
______________________________**_________________
wp-hackers mailing list
http://lists.automattic.com/**mailman/listinfo/wp-hackers<http://lists.automattic.com/mailman/listinfo/wp-hackers>
--
thanks
*
*
*jesse friedman*
jes.se.com *
*
Book: Web Designers Guide to WordPress -
http://wdgwp.com/onamazon<http://wdgwp.com/onamazon>
Twitter: @professor <http://twitter.com/professor>
Facebook: Like<https://www.facebook.com/pages/Jesse-Friedman/204793299545174>
Alex Rayan
2013-09-17 19:33:42 UTC
Permalink
Hi David,

I've used the following code to upload a file to a remote WP via XML RPC:

$data = array(
'name' => basename($fn),
'type' => 'video/mp4',
'bits' => new IXR_Base64($x),
'overwrite' => false,
);
if (!$client->query('wp.uploadFile','', 'username','password',$data)) {
die('An error occurred -
'.$client->getErrorCode().":".$client->getErrorMessage());
}
$response = $client->getResponse();
$video = $response['url'];

Might not be useful to you though if the files are too large.
Thought I'd share anyway.

For large files I used cURL.

Best regards,
Alex
Post by Jesse Friedman
I haven't but, I have seen JSON used to do it.
On Tue, Sep 17, 2013 at 2:09 PM, Abdussamad Abdurrazzaq <
Post by Abdussamad Abdurrazzaq
Don't use curl directly. Use wp_remote_get.
Post by Martin Lazarov
If you host this file somewhere you can just send link to the plugin
and using curl to download the remote file from the plugin.
Hi,
Has anyone ever written code to send a file, in chunks, from one WP install
to another, using XMLRPC? That's a task I've got to work on soon - but
I
Post by Abdussamad Abdurrazzaq
Post by Martin Lazarov
don't want to re-invent the wheel.
My plugin code will be installed at both ends.
The files are potentially very large. Basically, the sending end needs to be
a) See how much of the file is already uploaded ("oy, how much of this file
have you already got?")
b) Send the next chunk, in a loop ("here's a chunk - thanks - here's a chunk
- thanks ...")
Many thanks,
David
--
WordShell - WordPress fast from the CLI - www.wordshell.net
______________________________**_________________
wp-hackers mailing list
http://lists.automattic.com/**mailman/listinfo/wp-hackers<
http://lists.automattic.com/mailman/listinfo/wp-hackers>
Post by Abdussamad Abdurrazzaq
Post by Martin Lazarov
______________________________**_________________
wp-hackers mailing list
http://lists.automattic.com/**mailman/listinfo/wp-hackers<
http://lists.automattic.com/mailman/listinfo/wp-hackers>
Post by Abdussamad Abdurrazzaq
Post by Martin Lazarov
______________________________**_________________
wp-hackers mailing list
http://lists.automattic.com/**mailman/listinfo/wp-hackers<
http://lists.automattic.com/mailman/listinfo/wp-hackers>
--
thanks
*
*
*jesse friedman*
jes.se.com *
*
Book: Web Designers Guide to WordPress -
http://wdgwp.com/onamazon<http://wdgwp.com/onamazon>
Facebook: Like<
https://www.facebook.com/pages/Jesse-Friedman/204793299545174>
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
Loading...