Results 1 to 4 of 4

Thread: Issue with CURL

  1. #1
    Join Date
    Nov 2010
    Posts
    114
    Thanks
    27
    Thanked 0 Times in 0 Posts

    Default Issue with CURL

    Hi All,

    I am not exactly sure if i am doing it coreect or not but my issue is, in my site whenever user login into site a sms will go to the site-admin; For that i am using curl as mentioned below




    PHP Code:

    //after login is successfull


      
    $curl curl_init();
        
    curl_setopt ($curlCURLOPT_URL"http://name/page.php?num=123456789&msg=test");  

      
    // link was provided by my sms api provider. When i manually click on that link, sms will work fine but i need it to be automatic whenever user login into the site.
      

      
    curl_setopt($curlCURLOPT_RETURNTRANSFER1);

        
    $result curl_exec ($curl); 

    Above code is not working for me, just giving balnk page. Curl is installed in mine(Ubuntu) and tested.

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,162
    Thanks
    263
    Thanked 690 Times in 678 Posts

    Default

    I have no idea about sending the SMS, but I can explain your blank page-- there's nothing displayed from the PHP. Add echo 'test'; to check-- you'll get that.

    CURL is done completely on the server and (unless you display the results intentionally) nothing will show up for the user. It's "silent" or hidden in that sense. It looks like CURLOPT_RETURNTRANSFER should allow you to see the results, but it's possible that those results are completely blank.

    To see if you're getting a "FALSE", you should check this code:
    if(curl_exec($curl)===FALSE) { echo 'FALSE'; }
    If you don't see anything, that probably means it's just returning a blank page and it "worked". But--

    If you're not receiving the SMS, then you'll need to look at the SMS service and see what's wrong there.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Nov 2010
    Posts
    114
    Thanks
    27
    Thanked 0 Times in 0 Posts

    Default

    thanks for the info, but, is there a way to execute a url without redirecting it to new page through php script

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,162
    Thanks
    263
    Thanked 690 Times in 678 Posts

    Default

    Yes, curl is correct. That's what it's designed for. As I said, it looks roughly correct to me (although I don't use curl much-- it does seem to be a little less straight forward than other functions).
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Similar Threads

  1. How to curl the edges of an html box!
    By bbilal in forum HTML
    Replies: 2
    Last Post: 05-15-2011, 10:16 PM
  2. CURL and Javascript? Is it Possible?
    By sysout in forum PHP
    Replies: 0
    Last Post: 09-23-2009, 11:03 AM
  3. Curl login to https
    By php_techy in forum PHP
    Replies: 0
    Last Post: 06-22-2009, 06:09 AM
  4. cURL define script.
    By cursed in forum Looking for such a script or service
    Replies: 0
    Last Post: 11-08-2007, 01:04 AM
  5. Retaining SESSION using cURL
    By AikenD in forum PHP
    Replies: 1
    Last Post: 06-04-2007, 12:26 PM

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
  •