-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Curl Callback #276
base: master
Are you sure you want to change the base?
Curl Callback #276
Conversation
Hi @tareqtms, sorry to bother you. I was wondering if this could be considered as a new feature in the library? I've found it be very helpful in my projects to log API requests, especially when talking with Shopify Support who would like information about the request response headers. Thank you for the consideration. |
@whobutsb |
@whobutsb |
# Conflicts: # lib/CurlRequest.php
@tareqtms - I have resolved the merge conflicts. I'm not seeing any of your comments. I believe you need to submit the comments in the code section in the top right hand corner first for me to see what you commented on. I had this issue before working with other developers. |
Hi @tareqtms, looking forward to seeing your comments. Could you please submit them so I can review them and fix anything you requested. Thank you very much! |
Hi @tareqtms - Thank you for replying with the image and considering this PR. I have been using this curl callback on my own branch for a while and it has been very helpful to retrieve additional details which can be used by Shopify support to help diagnose issues. The
There are also lot so additional helpful methods you can use to get important information about the curl request. See: https://www.php.net/manual/en/function.curl-getinfo.php I have updated the Example to read "Shopify API Response" to help avoid confusion. Also I can see you have written the comments but you have not "requested" them so that I can see them. On the "Files changed" page in the top right hand corner you need to submit them with the "request changes" radio button. See: |
I've been working on extending some of the functionality of the
phpclassic/php-shopify
library as a Laravel Service Provider. One of the things that I wish I could do for every Curl request is to log the curl headers and response in a centralized place, rather than calling\PHPShopify\CurlRequest::$lastHttpResponseHeaders;
After every API request that I make.So I have added a feature that allows a user to set a callback to receive the
CurlResponse
information after every response.Usage:
I hope others will find this functionality useful. Thank you for the consideration.
UPDATE: Also now including the CurlHandle in the arguments. It is helpful to be able to log the curl requests total elapsed time.