Skip to main content
2 of 3
deleted 2 characters in body
No Sssweat
  • 31.6k
  • 14
  • 55
  • 91

Curl response into variable

Similar to Problem with cURL I have an api response which is returned at numerals only

If I break the code with a print_r($rate); which is where I point the curl response to an ajax error shows the correct response is being sent back as "ResponseText:0.09876787(command: . . . etc - but apparently it is not being put into the variable by

   $rate = curl_exec($ch);

my code runs fine at /devel/php and is returned into the variable and the code which uses $rate also runs to completion without any json decode and it is being sent as a html page if anything - as the number alone shows in a browser and page inspection shows html headers. The number 0.09876787 is what should be $rate.

I have fixed the http calls so no & is being changed to &amp as I have seen happen and the post above refers to also

So it runs correctly in the php devel window but not in the actual module

Is there something else different drupal 7 does to the response or needs to be done in code?