Skip to main content
There is no reference to Drupal or Commerce or Ubercart - this seems like a pure php/curl question
Link
deleted 2 characters in body
Source Link
No Sssweat
  • 31.6k
  • 14
  • 55
  • 91

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); "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$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.098767870.09876787 is what should be $rate$rate.

I have fixed the http calls so no & is being changed &ampto &amp as I have seen happen and the post abovepost 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?

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 &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?

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?

Source Link

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 &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?