Jump to content

Script stops working when an echo is put above function


papaface

Recommended Posts

Hey

 

I wonder if someone can help be debug a script that is giving me a right headache. The script receives data from an API.

 

I have this code:

	$message="<html><head><style>
body,td { font-family: verdana; font-size: 11px; font-weight: normal; }
a { color: #0000ff; }
</style></head><body>".$message."</body></html>";
echo "hello";
$Users=getClients();

 

getClients() function:

function getClients(){

global $count,$INCREMENT;

$url = "http://URLapi.php";

$username = "dev";

$password = "password";



$postfields["limitstart"] = $count;

$postfields["limitnum"] = $INCREMENT;

$postfields["action"] = "getclients";

$postfields["username"] = $username;

$postfields["password"] = md5($password);	





$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);

curl_setopt($ch, CURLOPT_POST, 1);

curl_setopt($ch, CURLOPT_TIMEOUT, 100);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);

$data = curl_exec($ch);

curl_close($ch);
echo $data;

$xml = simplexml_load_string($data);

$Xml = simpleXMLToArray($xml,true,true,true);



return $Xml;

}

 

If you look in the first bit of code you'll see

echo "hello";

If I remove this the data from the cURL request outputs to the screen via my echo $data; code.

If I keep echo "hello"; it stops processing and nothing is displayed.

 

What could be causing this?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.