Posting XML from PHP


There is a frequent need to post xml data to a url. Below is shown an example which lets you post xml data using CURL.


sdsd.


Download code

This site is a digital habitat of Sameer Borate, a freelance web developer working in PHP, MySQL and WordPress. I also provide web scraping services, website design and development and integration of various Open Source API's. Contact me at metapix[at]gmail.com for any new project requirements and price quotes.

7 Responses

1

Joel

May 12th, 2010 at 5:03 am

Excellent example. Clear, short, sweet and awesome handwriting font to boot. What font is that?

2

Jess

June 5th, 2010 at 5:23 am

Wow excellent script but am getting error message “Bad Request (Invalid URL)” am using IP instead domain on URL

can you help me what went wrong?

3

Maven

August 25th, 2012 at 12:40 pm

I’m getting the same error. Bad Request (Invalid URL)

4

mike murray

September 14th, 2012 at 3:27 pm

Hello. I’m very na├»ve to the idea of HTML, XML, and such. I was wondering if you could simply tell me how to take an XML feed or an HTML feed and automatically have it go to a post on my page? I have it set up already where e-mails automatically go to post, but I would really like to be able to take XML feeds from sports pages and have those automatically go to my posts. I hope I’m not sounding too stupid as I come from the day where I used to set the VCR for my dad. You can e-mail me back at the address I provided and I hope that you might build to provide me with an explanation. I can understand. Thank you very much for your time

5

Echoing PHP Variable inside XML | Jisku.com - Developers Network

September 19th, 2012 at 10:27 am

[...] was using this link to figure it out: http://www.codediesel.com/php/posting-xml-from-php/ Sep 19, 2012 No Comments » Posted in PHP [...]

6

hli

November 5th, 2012 at 8:56 am

There is an error in your header options. After POST the uri is expected.
So if you omit the headers apart from content-type everything works as expected.
Or use this http://www.phpmind.com/blog/2009/08/how-to-post-xml-using-curl/ instead.

7

real estate office management

December 26th, 2012 at 2:03 pm

Heya just wanted to give you a brief heads up and let you know
a few of the images aren’t loading properly. I’m
not sure why but I think its a linking issue.
I’ve tried it in two different internet browsers and both show the same results.

Your thoughts

Sign up for fresh content in your email