RE: CURL vs stream_socket_client

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: Yves Arsenault [mailto:yves.arsenault@xxxxxxxxx]
> Sent: Friday, January 30, 2009 9:40 AM
> To: PHP List
> Subject:  CURL vs stream_socket_client
> 
> Hi there,
> I'm not in PHP on a daily basis, but from time to time I get to
program
> a
> little in PHP for certain projects.
> 
> Recently, I've installed a Magento system... and I've installed a
> canada
> post shipping module for this system.
> 
> One thing that seems to be tripping it up is that it's using curl.
> 
> curl is attempting to send xml data to canada post's server on port
> 30000.
> The response from canada post's system is always an html page...
> 
> I've run a test using stream_socket_client and have gotten it to work,
> the
> canada post's system responds with the corresponding XML data with
> shipping
> info.
> 
> I'm wondering if there are any curlopt_ options that should be set
that
> aren't currently set...
> Could be that curl is not sending properly formatted XML.

This may be a stretch, but try to set the User Agent string to mimic
Firefox before sending your request. I wrote a PHP scrape to gather
guild member information from the World Of Warcraft Armory [1] a few
years back, and it kept giving me HTML instead of XML until I used the
User Agent of a browser that most sites accept is capable of parsing
XML.

A lot of sites conditionally send IE (and unknown browsers) XHTML
instead of XML if there is any transformation of data involved.

Also--your comment "Could be that curl is not sending properly formatted
XML" is possible. Have you looked at the resulting HTML that is sent to
curl to make sure that it's not a server error message? If it's the
results you were looking for (but in XHTML format instead of XML), I'll
bet it's a User Agent thing.

Just a thought...


// Todd

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux