puks1978
puks1978

Reputation: 3697

PHP curl and Web Proxy...maybe

I have a script which calls an external API using curl. This script worked perfectly when the website was on a dedicated server however I have had to move the server to a load balanced set up which sits behind a proxy and now for some reason I get

PHP Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: Entity: line 1: parser error : Start tag expected, '<' not found in...file name.

In Firebug it comes back as a 500 error if there is a result (formatted XML) otherwise it processes as normal.

I am running Zend CE 5.1.0 with only the default modules installed. Do I need to set something on the proxy or do I need to install additional modules to get this working.

If you need further information let me know.

Cheers

Upvotes: 0

Views: 613

Answers (1)

giker
giker

Reputation: 4245

Did you defined your proxy in php?

Something like:

define('HTTP_PROXY_HOST', '192.168.100.100');
define('HTTP_PROXY_PORT', '8080');
if (defined('HTTP_PROXY_HOST') && HTTP_PROXY_HOST != '') {
  curl_setopt($ch, CURLOPT_PROXY, HTTP_PROXY_HOST);
}
if (defined('HTTP_PROXY_PORT') && HTTP_PROXY_PORT != '') {
  curl_setopt($ch, CURLOPT_PROXYPORT, HTTP_PROXY_PORT);
}

Upvotes: 1

Related Questions