SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: Quick cURL Question

  1. #1
    SitePoint Addict svcghost's Avatar
    Join Date
    Oct 2010
    Posts
    288
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Quick cURL Question

    Hey guys,

    How well does cURL work with a lot of users sending requests to a server?
    For example, if a server accepts a URL from users, and like 20 people send a URL to the server around the same time, will the server be able to handle all the cURL requests? How is the performance? The server will be taking the URLs from users and doing this:

    Code:
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_REFERER, $url);
    curl_setopt($curl, CURLOPT_VERBOSE, true);
    curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10);
    curl_setopt($curl, CURLOPT_TIMEOUT, 10);
    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_AUTOREFERER, true );
    curl_getinfo($curl, CURLINFO_EFFECTIVE_URL);
    curl_exec($curl);
    curl_close ($curl);
    As you can see, the server doesn't even echo what is returned from cURL, but it does run the exec..

  2. #2
    SitePoint Mentor bronze trophy
    chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,041
    Mentioned
    9 Post(s)
    Tagged
    1 Thread(s)
    I would have to take a stab and say it would be fine as usually only when your sending and receiving does it become a problem.
    Blog/Portfolio | Evolution Xtreme | DFG Design | DFG Hosting | CSS-Tricks | Stack Overflow | Paul Irish
    Having lame problems with your code? Let us help by using a jsFiddle

  3. #3
    SitePoint Addict svcghost's Avatar
    Join Date
    Oct 2010
    Posts
    288
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay let's say the server sends back (through echo) the
    Code:
    curl_getinfo($curl, CURLINFO_EFFECTIVE_URL);
    but that's all. Now do you see a problem? Or do you think it can handle a fair amount of users?

  4. #4
    SitePoint Mentor bronze trophy
    chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,041
    Mentioned
    9 Post(s)
    Tagged
    1 Thread(s)
    I personally think very small bits of data a server can handle fine but massive requests like remote files uploads and form i think will start to lag the server.
    Blog/Portfolio | Evolution Xtreme | DFG Design | DFG Hosting | CSS-Tricks | Stack Overflow | Paul Irish
    Having lame problems with your code? Let us help by using a jsFiddle

  5. #5
    SitePoint Member
    Join Date
    Apr 2011
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's hard to say without having more information, eg how big is the site you are retrieving, is it a dedicated server or budget shared hosting, how much traffic will you have.

    Under normal circumstances you shouldn't have any problems with that code, especially since you have the timeout.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •