No matter what I do, the stockapi table is not populated with symbols, and thus nothing is fetched in cron run.
I configured the user quotes, and pressed 'save', and it got saved correctly into the {stock} table:
mysql> select * from stock;
+-----+----------------+
| uid | symbols |
+-----+----------------+
| 1 | GOOG YHOO MSFT |
+-----+----------------+
1 row in set (0.00 sec)
But looking at the stockapi table I get
mysql> select * from stockapi;
Empty set (0.00 sec)
I also can't find anywhere in stock.module code where it calls stockapi_save(), so I see why this happens. There is nothing in the watchdog as well. Screenshot attached.
Please point me to what I am missing..
Thanks.
Comments
Comment #1
kbahey commentedProbably your host is preventing opening sockets to remote sites due to security reasons.
Comment #2
yhager commentedNo, this is not the case, everything is running on localhost, and all ports are open.
Comment #3
yhager commentedThis wasn't an issue with openning sockets, rather with calling file_get_contents with a URL parameter.
I've had 'allow_url_fopen' set to off, since this is less secure (see http://lwn.net/Articles/203904/).
I've solved this for now by setting it to On, but please consider using curl instead:
Comment #4
kbahey commentedCurl is not available in all installations.
There is also drupal_http_request().
If you have a working, tested and properly formatted patch that provides an option on whether to use file_get_contents, or curl, I will included.
Better make the option self discover what is available, and default to that too.
I will wait for the patch.
Comment #5
yhager commentedWell, having drupal_http_request() for us, I see no reason to using something else.
I hope the patch is fine, it works for me.
Comment #6
kbahey commenteddrupal_http_request() uses fsockopen() and fwrite()/fread(), which some PHP configurations may have blocked too.
Better have 2 options, the default would be drupal_http_request() and another selectable option (radio button), with the file_get_contents().
This way backward compatibility is maintained.
Curl can be left off for a future patch, if someone needs it.
So, please redo the patch with the two options above.
Comment #7
yhager commenteddrupal_http_request() is the way drupal core handles HTTP requests (see aggregator.module). I see no reason why the stockapi module should behave differently. I think it will just add redundant clutter to the UI of the stockapi if you were to add a selection box of the http request method.
As a matter of fact, I can't think of reason to build a setup that will block fsockopen(), but will allow openning a URL with fopen().
Comment #8
kbahey commentedI redid the patch to have error checking and watchdog logging.
Fixed.
Comment #9
yhager commentedGreat, thanks.
Comment #10
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.