Skip to content
Advertisement

Send string as a file using curl and php

I know I can use this syntaxt to send a file using php, post and curl.

JavaScript

How can I take a string, build a temp file and send it using the exact same syntax ?

Update: I would prefer using tmpfile() or php://memory so I don’t have to handle file creation.

Advertisement

Answer

You can create a file using tempnam in your temp directory:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement