PHPiSean Posted November 1, 2009 Share Posted November 1, 2009 Hey guys, I've been trying to make a proxy application with cURL, and I'm having trouble with structuring my code. I don't know how long to make it, and cURL is a bit difficult to understand. Here's a code, and if you can help me structure it, that would be great. <html> </head> <body> <center> <form type=index.php name=proxy method=POST> <input type=text name=bar width=300px> <input type=submit name=search value=Proxy> </form> </center> <?php $sb=$_POST['bar'] $s=$_POST['search'] $ci=curl_init(); $ce=curl_exec(); $cc=curl_close(); curl_setopt($ci,CURLOPT_HEADER, true, ['proxy']; $o=fopen $0($sb) $ci </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/179838-help-with-structuring-code/ Share on other sites More sharing options...
Mchl Posted November 1, 2009 Share Posted November 1, 2009 What do you mean by 'structuring code' ? Quote Link to comment https://forums.phpfreaks.com/topic/179838-help-with-structuring-code/#findComment-948737 Share on other sites More sharing options...
PHPiSean Posted November 1, 2009 Author Share Posted November 1, 2009 what functions need to be there and the order of functions. Basically, haven't been programming PHP much, but the best way to learn in my opinion is to push yourself. Code structure is something I struggle in. Quote Link to comment https://forums.phpfreaks.com/topic/179838-help-with-structuring-code/#findComment-948834 Share on other sites More sharing options...
PHPiSean Posted November 1, 2009 Author Share Posted November 1, 2009 any help? Quote Link to comment https://forums.phpfreaks.com/topic/179838-help-with-structuring-code/#findComment-948868 Share on other sites More sharing options...
redarrow Posted November 1, 2009 Share Posted November 1, 2009 What you mean bro. Â explain to us what you mean, slowly with good examples cheers. Â we no, you want to understand order of code, but we don't get what wrong.... Â The order of code, is suppose to be from your coding order. Â example. Â //varable $name value as john. Â $name="john"; Â //now i want to echo it. echo $name. Â my code order to set a variable and echo the result. Quote Link to comment https://forums.phpfreaks.com/topic/179838-help-with-structuring-code/#findComment-948873 Share on other sites More sharing options...
PHPiSean Posted November 1, 2009 Author Share Posted November 1, 2009 Look at my proxy server code. Using cURL, what am I missing and what do IÂ have to include to make it all work. Quote Link to comment https://forums.phpfreaks.com/topic/179838-help-with-structuring-code/#findComment-948876 Share on other sites More sharing options...
redarrow Posted November 1, 2009 Share Posted November 1, 2009 why didn't you say you want to learn CURL Â Â now we no it a Curl question ..... Quote Link to comment https://forums.phpfreaks.com/topic/179838-help-with-structuring-code/#findComment-948877 Share on other sites More sharing options...
Mchl Posted November 1, 2009 Share Posted November 1, 2009 Let's start with this: curl_setopt($ci,CURLOPT_HEADER, true, ['proxy']; $o=fopen $0($sb) $ci  Don't know where you got it, but it's full of syntax errors.  Next: $ci=curl_init(); $ce=curl_exec(); $cc=curl_close();  What are you trying to do here?  [added]  Did you see example here? http://www.php.net/manual/en/curl.examples-basic.php  Quote Link to comment https://forums.phpfreaks.com/topic/179838-help-with-structuring-code/#findComment-948879 Share on other sites More sharing options...
PHPiSean Posted November 1, 2009 Author Share Posted November 1, 2009 Here's what I'm trying to do. The user types the requested URL into the text bar, which then users cURL to locate the desired website. My question is, using cURL, what am I missing from this script, (syntax will be fixed) and what do I need to know to fix the problem. I have read the cURL manuals. Quote Link to comment https://forums.phpfreaks.com/topic/179838-help-with-structuring-code/#findComment-948886 Share on other sites More sharing options...
Mchl Posted November 1, 2009 Share Posted November 1, 2009 Now read cUrl manual on php.net because you obviously didn't. Quote Link to comment https://forums.phpfreaks.com/topic/179838-help-with-structuring-code/#findComment-948895 Share on other sites More sharing options...
redarrow Posted November 1, 2009 Share Posted November 1, 2009 As time go on, and more and more web sites realize that everybody taking there info away, there all use token's then all this curl business stops,,,. Quote Link to comment https://forums.phpfreaks.com/topic/179838-help-with-structuring-code/#findComment-948898 Share on other sites More sharing options...
PHPiSean Posted November 1, 2009 Author Share Posted November 1, 2009 Mchi, I have looked at that plenty of times, but some of the manuals say nothing except that no user information was given. Quote Link to comment https://forums.phpfreaks.com/topic/179838-help-with-structuring-code/#findComment-948907 Share on other sites More sharing options...
redarrow Posted November 1, 2009 Share Posted November 1, 2009 Did you read my post, if a web site has token ised there url, then you want get any info. Â they might do it via cookies or sessions or ajax/javasript. Â not all web sites allow content to be theft. Â soon none will wait and see. Â Â Quote Link to comment https://forums.phpfreaks.com/topic/179838-help-with-structuring-code/#findComment-948910 Share on other sites More sharing options...
Mchl Posted November 1, 2009 Share Posted November 1, 2009 Fine. But I gave you a link to pretty simple example. Can you see differences between it and your code? Quote Link to comment https://forums.phpfreaks.com/topic/179838-help-with-structuring-code/#findComment-948912 Share on other sites More sharing options...
redarrow Posted November 1, 2009 Share Posted November 1, 2009 Mchi i am sure that the user will have to still learn to pattern match via reg expression to get correct results? Â Â Quote Link to comment https://forums.phpfreaks.com/topic/179838-help-with-structuring-code/#findComment-948914 Share on other sites More sharing options...
Mchl Posted November 1, 2009 Share Posted November 1, 2009 Not until he finally succeeds in fetching the remote page. Quote Link to comment https://forums.phpfreaks.com/topic/179838-help-with-structuring-code/#findComment-948919 Share on other sites More sharing options...
Daniel0 Posted November 1, 2009 Share Posted November 1, 2009 Did you read my post, if a web site has token ised there url, then you want get any info. Â What is that supposed to mean? Quote Link to comment https://forums.phpfreaks.com/topic/179838-help-with-structuring-code/#findComment-948920 Share on other sites More sharing options...
PHPiSean Posted November 1, 2009 Author Share Posted November 1, 2009 Mchi i am sure that the user will have to still learn to pattern match via reg expression to get correct results? Â That is correct, it's kind of like a sequence, and I'm always struggling to see which functions/plain out syntax, should go in the order they are in. Quote Link to comment https://forums.phpfreaks.com/topic/179838-help-with-structuring-code/#findComment-948929 Share on other sites More sharing options...
PHPiSean Posted November 1, 2009 Author Share Posted November 1, 2009 for example, should I run curl_exec or curl_init at the beginning, confusing to me. Mchi, I'm trying to learn PHP, the reason I jumped into cURL so early is for one reason is, I've been using some proxys to access my test server, and I thought it would be cool to make my own. My questions might be noobish, but bear with me please. Quote Link to comment https://forums.phpfreaks.com/topic/179838-help-with-structuring-code/#findComment-948933 Share on other sites More sharing options...
Mchl Posted November 1, 2009 Share Posted November 1, 2009 The example I posted shows the correct order. First you init, then set options, execute and close. Quote Link to comment https://forums.phpfreaks.com/topic/179838-help-with-structuring-code/#findComment-948935 Share on other sites More sharing options...
PHPiSean Posted November 1, 2009 Author Share Posted November 1, 2009 more understandable now. I'll learn more as I go on, trying to answer some questions on this forum myself Quote Link to comment https://forums.phpfreaks.com/topic/179838-help-with-structuring-code/#findComment-948938 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.