Forcing cURL to use DNS though SOCK5 proxy

I recently had to code a REST call to a service I could only access behind a SOCK5 proxy.  Unfortunately, the hostname of the service wasn’t publicly resolvable so the DNS had to be resolved on the other side of the proxy.  Whilst this is pobbible in cURL itself by using the CURLOPT_PROXYTYPE option and setting it to CURLPROXY_SOCKS5_HOSTNAME or by using the flag –socks5-hostname – the constant isn’t available within PHP.  This feature was requested in https://bugs.php.net/bug.php?id=65469 however hasn’t yet been implemented.  This can simply be worked around by setting the proxy type to 7.  The code below shows an example of doing this using the Httpful library, however if you were using curl natively you’d just use curl_setopt()

 

Creating a custom form field type in symfony 2

I am finally starting to dive into symfony 2 properly. Yes – it’s taken a while, work has taken me in different directions! I found myself needing to create a custom form field type pretty quickly, but couldn’t find much in the way of documentation to do so, so I thought I’ld throw it up here; partly to help others, but mostly to get feedback to make sure I’m not approaching this from the wrong angle.

Continue reading “Creating a custom form field type in symfony 2”

Using VERP with swiftmailer, symfony and exim

VERP (http://en.wikipedia.org/wiki/Variable_envelope_return_path) provides a method for handling bounced emails. This is especially useful when it comes to figuring out which emails failed to get delivered from your application/mail outs. This post covers how I got this working in symfony using swiftmailer to send the mail, and exim to deliver bounces back into symfony. The concepts shown can be applied to just about any combination of software though.

Continue reading “Using VERP with swiftmailer, symfony and exim”

Date/Time Range Selector Widget for Symfony

I needed to create a date/time widget for use in an sfForm in a symfony project I was working on, and unfortunately there’s not currently a widget that I could find to allow this. In this post I show how I solved this problem, creating a widget for selecting a date range, using the jquery date selector from sfFormExtraPlugin.

Continue reading “Date/Time Range Selector Widget for Symfony”

Sending multipart email from a Task in symfony 1.4

I recently needed to send the result of an action in symfony via email daily. E-mail has changed slightly in symfony 1.3/1.4 – here’s how I did it. I really don’t like my solution at all, the use of get_partial() from within a Task seems very wrong to me – but I’m in a rush so it will do for now, I’d love to hear feedback

Continue reading “Sending multipart email from a Task in symfony 1.4”