Loading...

Professional-PHP@googlegroups.com

[Prev] Thread [Next]  |  [Prev] Date [Next]

[Pro. PHP Dev.] Re: Question about CURL nickW+ Fri Feb 03 22:05:58 2012

Yeah, sounds like the best plan to be honest. They do have a
order_find option so maybe I can call the API to see if the order
exist (there might be some issues with this that I don't foresee). If
it doesn't exist try again, if exists that would be their order_id.

The curl code posted above is correct right? I don't have anything
important missing from there? Meaning the problem must be outside my
network right? I checked the ping from my server to their server is
only 34 ms. Shouldn't timeout.


On Feb 3, 9:02 pm, Robert Gonzalez <[EMAIL PROTECTED]>
wrote:
> Something you could do is set your timeout limit and if nothing comes back
> in that time frame, just fail gracefully and log it. After a certain number
> of consecutive empty responses, notify someone. Just an idea. Outside of
> that, not sure what else you could do.
>
>
>
>
>
>
>
>
>
> On Fri, Feb 3, 2012 at 3:41 PM, nickW+ <[EMAIL PROTECTED]> wrote:
> > It's a CRM system which I don't control unfortunately so I don't have
> > any info from their side :(
>
> > On my end really there is nothing aside from a curl call. I get a
> > response or I don't. There is simply nothing else there.
>
> > That's why I came here it's tricky and not very transparent where the
> > problem lies.
>
> > Anything else I can do, aside from send an email to ourselves
> > everytime this happens and contact the other end? Maybe I should check
> > the response code? Or? I dunno.
>
> > On Feb 3, 4:13 pm, Robert Gonzalez <[EMAIL PROTECTED]>
> > wrote:
> > > 0 bytes received could be the last step of the failure, which *could*
> > have
> > > happened just after a DB request. Just throwing that out there.
>
> > > Have you tried logging each step of the request/response process? That
> > way
> > > you might be able to capture where things are dying.
>
> > > On Fri, Feb 3, 2012 at 1:50 PM, nickW+ <[EMAIL PROTECTED]> wrote:
> > > > I totally agree with you but the response I'm getting is simply:
>
> > > > : Operation timed out after 10000 milliseconds with 0 bytes received
> > > > in on line
>
> > > > Any ideas?
>
> > > > On Feb 3, 9:19 am, Robert Gonzalez <[EMAIL PROTECTED]>
> > > > wrote:
> > > > > I think you need to look at why the timeouts are happening not how to
> > > > > handle them in the curl request. Just my opinion.
>
> > > > > On Thursday, February 2, 2012, nickW+ <[EMAIL PROTECTED]> wrote:
> > > > > > Hello All,
>
> > > > > > I'm using the following function. Are there any additional options
> > I
> > > > > > can add or change that would help avoid timeouts? I am randomly
> > > > > > getting timeouts when I submit the call. I increased the timeout
> > from
> > > > > > 4 to 10.
>
> > > > > > [code]
> > > > > >    /**
> > > > > >     * Send a POST requst using cURL
> > > > > >     * @param string $url to request
> > > > > >     * @param array $post values to send
> > > > > >     * @param array $options for cURL
> > > > > >     * @return string
> > > > > >     */
> > > > > >    function curl_post($url, array $post = NULL, array $options =
> > > > > > array()) {
> > > > > >        $defaults = array(
> > > > > >            CURLOPT_POST => 1,
> > > > > >            CURLOPT_HEADER => 0,
> > > > > >            CURLOPT_URL => $url,
> > > > > >            CURLOPT_FRESH_CONNECT => 1,
> > > > > >            CURLOPT_RETURNTRANSFER => 1,
> > > > > >            CURLOPT_FORBID_REUSE => 1,
> > > > > >            CURLOPT_TIMEOUT => 10,
> > > > > >            CURLOPT_POSTFIELDS => http_build_query($post)
> > > > > >        );
>
> > > > > >        $ch = curl_init();
> > > > > >        curl_setopt_array($ch, ($options + $defaults));
> > > > > >        if( ! $result = curl_exec($ch))
> > > > > >        {
> > > > > >            trigger_error(curl_error($ch));
> > > > > >        }
> > > > > >        curl_close($ch);
> > > > > >        return $result;
> > > > > >    }
> > > > > > [/code]
>
> > > > > > Thank you in advance!
>
> > > > > > --
> > > > > > This group is managed and maintained by the development staff at
> > 360
> > > > PSG.
>
> > > > > An enterprise application development company utilizing open-source
> > > > > technologies for todays small-to-medium size businesses.
>
> > > > > > For information or project assistance please visit :
> > > > > >http://www.360psg.com
>
> > > > > > You received this message because you are subscribed to the Google
> > > > Groups
>
> > > > > "Professional PHP Developers" group.> To post to this group, send
> > email
> > > > to [EMAIL PROTECTED]
> > > > > > To unsubscribe from this group, send email to
>
> > > > > [EMAIL PROTECTED]> For more options,
> > visit
> > > > this group at
>
> > > > >http://groups.google.com/group/Professional-PHP
>
> > > > > --
>
> > > > > Robert Gonzalez
> > > > > <https://plus.google.com/103821781336302925338/about>
> > > > > <http://twitter.com/RobertGonzalez>
> > > > >   <http://www.facebook.com/robertgonzalez>
> > > > > <http://www.linkedin.com/in/robertanthonygonzalez>
>
> > > > --
> > > > This group is managed and maintained by the development staff at 360
> > PSG.
> > > > An enterprise application development company utilizing open-source
> > > > technologies for todays small-to-medium size businesses.
>
> > > > For information or project assistance please visit :
> > > >http://www.360psg.com
>
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "Professional PHP Developers" group.
> > > > To post to this group, send email to [EMAIL PROTECTED]
> > > > To unsubscribe from this group, send email to
> > > > [EMAIL PROTECTED]
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/Professional-PHP
>
> > > --
>
> > > Robert Gonzalez
> > > <https://plus.google.com/103821781336302925338/about>
> > > <http://twitter.com/RobertGonzalez>
> > >   <http://www.facebook.com/robertgonzalez>
> > > <http://www.linkedin.com/in/robertanthonygonzalez>
>
> > --
> > This group is managed and maintained by the development staff at 360 PSG.
> > An enterprise application development company utilizing open-source
> > technologies for todays small-to-medium size businesses.
>
> > For information or project assistance please visit :
> >http://www.360psg.com
>
> > You received this message because you are subscribed to the Google Groups
> > "Professional PHP Developers" group.
> > To post to this group, send email to [EMAIL PROTECTED]
> > To unsubscribe from this group, send email to
> > [EMAIL PROTECTED]
> > For more options, visit this group at
> >http://groups.google.com/group/Professional-PHP
>
> --
>
> Robert Gonzalez
> <https://plus.google.com/103821781336302925338/about>
> <http://twitter.com/RobertGonzalez>
>   <http://www.facebook.com/robertgonzalez>
> <http://www.linkedin.com/in/robertanthonygonzalez>

-- 
This group is managed and maintained by the development staff at 360 PSG. An 
enterprise application development company utilizing open-source technologies 
for todays small-to-medium size businesses.

For information or project assistance please visit :
http://www.360psg.com

You received this message because you are subscribed to the Google Groups 
"Professional PHP Developers" group.
To post to this group, send email to [EMAIL PROTECTED]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Professional-PHP