the fact that you see width = 0.0 instead of 320.0 is a known issue of the target Manager UI, which does not reflect the actual width of targets that have been updated throught the VWS API (but your target width is actually correctly set to 320, so, no need to worry about that; we are also working to fix the TM UI).
Concerning the failure message, the bad request error typically does not indicate a connection problem, but rather something wrong with your HTTP request, which may be cause by:
- the metadata (as David suggested), or:
- the image (maybe some of your images are too large ? consider that the max allowed size is 2.25 MB), or:
- something wrong with the way you setup your query.
Have you tried using the original PHP sample code (without any changes) and just uploading an image which is stored locally on your file system ? also, make sure the image is JPG or PNG, in RGB 24-bit format (no CMYK or RGBA), and that the size does not exceed 2.25 MB.
Also, the metadata size should not exceed 150KB.