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
https://forums.phpfreaks.com/topic/297714-curl-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.