send a string as a parameter to a function

Discussion in 'PHP' started by srivisu, Jul 22, 2009.

  1. #1
    Here is what i tried.Can you please help me to resolve the below issue.Actually i would like to build a string and send it to curl_setopt function.Here is the below code which i tired.

    Even i tried with appending single quotes but it did not work.But if i substitute $urlstring with exact URL it works.Please help me in this regard



    Thanks and Regards
    Sree Aurovindh.V
    SCWCD

    $urlstring="http://www.example.com/sendsms.php?uid=948AVC433&pwd=abccc&phone=";
    $urlstring=$urlstring.$phone;
    $parameter="&msg=";
    $urlstring=$urlstring.$mailmessage;
    
    
    ch = curl_init();
    			
    			curl_setopt($ch, CURLOPT_URL,$urlstring);
    			
    			curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    			
    			$contents = curl_exec ($ch);
    			
    			curl_close ($ch);
    			echo $contents;
    
    PHP:
     
    srivisu, Jul 22, 2009 IP
  2. Martinoes

    Martinoes Peon

    Messages:
    110
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Check this code:

    
    $urlstring="http://www.example.com/sendsms.php?uid=948AVC433&pwd=abccc&phone=".$phone."&msg=".$mailmessage;
    
    ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,$urlstring);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $contents = curl_exec ($ch);
    curl_close ($ch);
    
    echo $contents;
    
    PHP:
     
    Martinoes, Jul 22, 2009 IP