Jump to content

Curl help?


moiisam10

Recommended Posts

Hello, am new to the forum. I want to grow as php coder and try to learns as much as possible, thanks for all.. Look i need some help triying to use my CURL code with a php text box.. 

 

The problem is that i parse the textbox to url by javascript function.

<?php 
$url = "?nie=";
?>	
	<script type="text/javascript">
            function doStuff() {
                window.location.href="?nie="+encodeURIComponent(document.getElementById('tb1').value);
            }
        </script>
		
        <form action="" method="post">
            <input type="text" id="tb1">
            <input type="button" value="Buscar" onclick="doStuff()">
        </form>

but i need to parse that url to the CURL url.

$url = "?nie=";
$ch=curl_init();
$timeout=5;

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);

// Get URL content
$lines_string=curl_exec($ch);
// close handle to release resources
curl_close($ch);
//output, you can also save it locally on the server
echo $lines_string;
?>

in the URL, the "?nie=" part is the value of the textbox.. the problem is.. If i put in the textbox 12464883 i need to put 12464883 in the "?nie="... Thanks in advanced and sorry for my bad english i am from venezuela.. Thanks to all

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.