New here? Read Greetings Earthling!

MultiPart Form Encoding In PHP | POST File Uploads

HTML Forms & Multipart

With POST operations, 99% of the times the data is application/x-www-form-urlencoded which is the format you get from http_build_query. But, when you upload files (large data) you need multipart forms which are built for the big items. So, to upload files using HTML forms, you need to add enctype="multipart/form-data" to your form and use input="file" inputs.

To achieve this with cURL you need to set the file POSTFIELDS like this field => @file_path. But I never enjoy letting others encode my own shit. So I needed to take control here and create a function that can Multipart Encode to a string or a local file. Outputing to a string is good for small data but outputing to a file is good for large data that should not be handled in memory. As cURL accepts INFILE and INFILESIZE for the likes of POSTs and PUTs to send data from a file (not from memory) we can combine the two functions and make file uploads dead easy.
Read the rest of this entry »

elHttpClient Evolution - PHP + cURL + HTTP

My mildly wildly popular eHttpClient class no longer available on my old blog has evolved. It changed into elHttpClient, an all new toy for the fellow blackhats and php coders. eHttpClient is the one-stop solution for web downloading combining the power of cURL with PHP to provide a dead easy solution for your web downloading (scraping) needs.With basic knowledge you can do anything in terms of downloading web content.

This class has been by far my most popular share and brought in most feedback. I've looked into the feedback trying to make things even easier and this was born. Oh wtf ... the truth is I've written this for myself and decided to share it! I didn't care about no feedback.
Read the rest of this entry »