0

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

1 Answer 1

1

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);
}
Sign up to request clarification or add additional context in comments.

6 Comments

No I hadnt however I have added an entry into windows registry and the site loads perfectly except for the one curl command. I will try your suggestion
Now I get PHP Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML'
Are you getting well formated XML back? Maybe problem is on other side?
Yeah I am because I used the exact same script on a different server. If I change the server back to the original IP it works. Do you think I am missing a php module?
Printr whatever you getting back.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.