clookid Posted September 25, 2007 Share Posted September 25, 2007 I would like multiple, different urls / proxy servers / proxy ports to be submitted, all on the same script (without having to create any other files). function file_get_contents_proxy($szURL, $szProxy, $iProxyPort) { $pCurl = curl_init($szURL); curl_setopt(CURLOPT_PROXY, $szProxy); curl_setopt(CURLOPT_PROXYPORT, $iProxyPort); curl_setopt(CURLOPT_FOLLOWLOCATION, true); curl_setopt(CURLOPT_RETURNTRANSFER, true); return curl_exec($pCurl); } $szURL = 'https://clooscript01:[email protected]/v1/posts/add?url=$url&description=$description&extended=$note&tags=$tags&shared=yes'; $szProxy = '221.233.134.87'; $iProxyPort = '8080'; file_get_contents_proxy($szURL, $szProxy, $iProxyPort); file_get_contents_proxy(Output different URL, Output different Proxy, Output different Port); How can I get that to work? Link to comment https://forums.phpfreaks.com/topic/70563-solved-curlphp-outputting-different-data/ Share on other sites More sharing options...
trq Posted September 25, 2007 Share Posted September 25, 2007 Puts the servers into an array then loop through it and execute your function. eg; <?php $servers = array( array( 'szURL' => 'https://clooscript01:[email protected]/v1/posts/add?url=$url&description=$description&extended=$note&tags=$tags&shared=yes', 'szProxy' => '221.233.134.87', 'iProxyPort' = '8080' ), array( 'szURL' => 'https://foo', 'szProxy' => '203.0.178.145', 'iProxyPort' = '8080' ) ); foreach ($servers as $server) { file_get_contents_proxy($server['szURL'], $server['szProxy'], $server['iProxyPort']); } ?> Link to comment https://forums.phpfreaks.com/topic/70563-solved-curlphp-outputting-different-data/#findComment-354583 Share on other sites More sharing options...
clookid Posted September 25, 2007 Author Share Posted September 25, 2007 <?php function file_get_contents_proxy($szURL, $szProxy, $iProxyPort) { $pCurl = curl_init($szURL); curl_setopt(CURLOPT_PROXY, $szProxy); curl_setopt(CURLOPT_PROXYPORT, $iProxyPort); curl_setopt(CURLOPT_FOLLOWLOCATION, true); curl_setopt(CURLOPT_RETURNTRANSFER, true); return curl_exec($pCurl); } $servers = array( array( 'szURL' => 'https://clooscript01:[email protected]/v1/posts/add?url=$url&description=$description&extended=$note&tags=$tags&shared=yes', 'szProxy' => '221.233.134.87', 'iProxyPort' = '8080' ), array( 'szURL' => 'https://clooscript02:[email protected]/v1/posts/add?url=$url&description=$description&extended=$note&tags=$tags&shared=yes', 'szProxy' => '202.105.182.13', 'iProxyPort' = '80' ) ); foreach ($servers as $server) { file_get_contents_proxy($server['szURL'], $server['szProxy'], $server['iProxyPort']); } ?> That will work, correct? Link to comment https://forums.phpfreaks.com/topic/70563-solved-curlphp-outputting-different-data/#findComment-354589 Share on other sites More sharing options...
trq Posted September 25, 2007 Share Posted September 25, 2007 That will work, correct? Try it and see! Link to comment https://forums.phpfreaks.com/topic/70563-solved-curlphp-outputting-different-data/#findComment-354603 Share on other sites More sharing options...
clookid Posted September 25, 2007 Author Share Posted September 25, 2007 http://www.ipsecured.info/test.php Parse error: syntax error, unexpected '=', expecting ')' in /home/ipsecure/public_html/test.php on line 39 Parse error: syntax error, unexpected '=', expecting ')' in /home/ipsecure/public_html/test.php on line 39 How do I fix the syntax errors? Link to comment https://forums.phpfreaks.com/topic/70563-solved-curlphp-outputting-different-data/#findComment-354620 Share on other sites More sharing options...
trq Posted September 25, 2007 Share Posted September 25, 2007 'iProxyPort' = '80' should be.... 'iProxyPort' => '80' Link to comment https://forums.phpfreaks.com/topic/70563-solved-curlphp-outputting-different-data/#findComment-354623 Share on other sites More sharing options...
clookid Posted September 25, 2007 Author Share Posted September 25, 2007 Warning: Wrong parameter count for curl_setopt() in /home/ipsecure/public_html/test.php on line 9 Warning: Wrong parameter count for curl_setopt() in /home/ipsecure/public_html/test.php on line 10 Warning: Wrong parameter count for curl_setopt() in /home/ipsecure/public_html/test.php on line 12 Warning: Wrong parameter count for curl_setopt() in /home/ipsecure/public_html/test.php on line 13 Sorry, Authorization Required. This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required. Please check the URL for proper spelling and capitalization. If you're having trouble locating a destination on Yahoo!, try visiting the Yahoo! home page or look through a list of Yahoo!'s online services. Also, you may find what you're looking for if you try searching below. (Loaded ten times) Accessible at: http://www.ipsecured.info/test.php Link to comment https://forums.phpfreaks.com/topic/70563-solved-curlphp-outputting-different-data/#findComment-354624 Share on other sites More sharing options...
d.shankar Posted September 25, 2007 Share Posted September 25, 2007 Warning: Wrong parameter count for curl_setopt() in /home/ipsecure/public_html/test.php on line 9 Warning: Wrong parameter count for curl_setopt() in /home/ipsecure/public_html/test.php on line 10 Warning: Wrong parameter count for curl_setopt() in /home/ipsecure/public_html/test.php on line 12 Warning: Wrong parameter count for curl_setopt() in /home/ipsecure/public_html/test.php on line 13 Your curl_setopt function is expecting the handle parameter. Add the handle to the curl_setopt function lke this curl_setopt($pCurl,CURLOPT_PROXY, $szProxy); in all your curl_setopt functions. Link to comment https://forums.phpfreaks.com/topic/70563-solved-curlphp-outputting-different-data/#findComment-354646 Share on other sites More sharing options...
clookid Posted September 25, 2007 Author Share Posted September 25, 2007 Now it just loads up a blank page (after about 30 seconds, again, http://www.ipsecured.info/test.php as an example). Below is a copy of the current file. Please let me know what needs changing in order for the script to work. Thank you. <?php function file_get_contents_proxy($szURL, $szProxy, $iProxyPort) { $pCurl = curl_init($szURL); curl_setopt($pCurl, CURLOPT_PROXY, $szProxy); curl_setopt($pCurl, CURLOPT_PROXYPORT, $iProxyPort); curl_setopt($pCurl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($pCurl, CURLOPT_RETURNTRANSFER, true); return curl_exec($pCurl); } $password = "mypasswordhere"; $title = "IP Secured"; $url = "http://www.ipsecured.info"; $description = "IP%20Secured"; $note = "IP%20Secured%20--%20you%20no%20longer%20need%20to%20worry%20about%20filters."; $tags = "ip%20secured,%20proxy"; $servers = array( array( 'szURL' => 'https://clooscript01:[email protected]/v1/posts/add?url=$url&description=$description&extended=$note&tags=$tags&shared=yes', 'szProxy' => '192.17.239.250', 'iProxyPort' => '3127' ), array( 'szURL' => 'https://clooscript02:[email protected]/v1/posts/add?url=$url&description=$description&extended=$note&tags=$tags&shared=yes', 'szProxy' => '128.8.126.112', 'iProxyPort' => '3124' ), array( 'szURL' => 'https://clooscript03:[email protected]/v1/posts/add?url=$url&description=$description&extended=$note&tags=$tags&shared=yes', 'szProxy' => '129.240.67.18', 'iProxyPort' => '3128' ), array( 'szURL' => 'https://clooscript04:[email protected]/v1/posts/add?url=$url&description=$description&extended=$note&tags=$tags&shared=yes', 'szProxy' => '212.241.168.184', 'iProxyPort' => '80' ), array( 'szURL' => 'https://clooscript05:[email protected]/v1/posts/add?url=$url&description=$description&extended=$note&tags=$tags&shared=yes', 'szProxy' => '156.17.10.52', 'iProxyPort' => '3124' ), array( 'szURL' => 'https://clooscript06:[email protected]/v1/posts/add?url=$url&description=$description&extended=$note&tags=$tags&shared=yes', 'szProxy' => '61.16.154.132', 'iProxyPort' => '80' ), array( 'szURL' => 'https://clooscript07:[email protected]/v1/posts/add?url=$url&description=$description&extended=$note&tags=$tags&shared=yes', 'szProxy' => '156.17.10.51', 'iProxyPort' => '3124' ), array( 'szURL' => 'https://clooscript08:[email protected]/v1/posts/add?url=$url&description=$description&extended=$note&tags=$tags&shared=yes', 'szProxy' => '194.103.159.85', 'iProxyPort' => '80' ), array( 'szURL' => 'https://clooscript09:[email protected]/v1/posts/add?url=$url&description=$description&extended=$note&tags=$tags&shared=yes', 'szProxy' => '213.114.118.44', 'iProxyPort' => '8080' ), array( 'szURL' => 'https://clooscript10:[email protected]/v1/posts/add?url=$url&description=$description&extended=$note&tags=$tags&shared=yes', 'szProxy' => '67.87.108.252', 'iProxyPort' => '7212' ) ); foreach ($servers as $server) { file_get_contents_proxy($server['szURL'], $server['szProxy'], $server['iProxyPort']); } echo "<a href='$url' alt='$title'>$title</a> has successfully been submitted to <a href='http://del.icio.us/clooscript01'>clooscript01</a>.<br />"; echo "<a href='$url' alt='$title'>$title</a> has successfully been submitted to <a href='http://del.icio.us/clooscript02'>clooscript02</a>.<br />"; echo "<a href='$url' alt='$title'>$title</a> has successfully been submitted to <a href='http://del.icio.us/clooscript03'>clooscript03</a>.<br />"; echo "<a href='$url' alt='$title'>$title</a> has successfully been submitted to <a href='http://del.icio.us/clooscript04'>clooscript04</a>.<br />"; echo "<a href='$url' alt='$title'>$title</a> has successfully been submitted to <a href='http://del.icio.us/clooscript05'>clooscript05</a>.<br />"; echo "<a href='$url' alt='$title'>$title</a> has successfully been submitted to <a href='http://del.icio.us/clooscript06'>clooscript06</a>.<br />"; echo "<a href='$url' alt='$title'>$title</a> has successfully been submitted to <a href='http://del.icio.us/clooscript07'>clooscript07</a>.<br />"; echo "<a href='$url' alt='$title'>$title</a> has successfully been submitted to <a href='http://del.icio.us/clooscript08'>clooscript08</a>.<br />"; echo "<a href='$url' alt='$title'>$title</a> has successfully been submitted to <a href='http://del.icio.us/clooscript09'>clooscript09</a>.<br />"; echo "<a href='$url' alt='$title'>$title</a> has successfully been submitted to <a href='http://del.icio.us/clooscript10'>clooscript10</a>.<br />"; ?> Link to comment https://forums.phpfreaks.com/topic/70563-solved-curlphp-outputting-different-data/#findComment-354651 Share on other sites More sharing options...
d.shankar Posted September 25, 2007 Share Posted September 25, 2007 Since you are using https urls you should add this code to your curl. curl_setopt($pCurl,CURLOPT_SSL_VERIFYPEER,false); Check out now. Link to comment https://forums.phpfreaks.com/topic/70563-solved-curlphp-outputting-different-data/#findComment-354652 Share on other sites More sharing options...
clookid Posted September 25, 2007 Author Share Posted September 25, 2007 It doesn't seem to have made any difference. Link to comment https://forums.phpfreaks.com/topic/70563-solved-curlphp-outputting-different-data/#findComment-354659 Share on other sites More sharing options...
d.shankar Posted September 25, 2007 Share Posted September 25, 2007 Try to keep a single URL in your array and check. The code would have failed because of some invalid url in your array. Btw did you increase the timeout seconds in your php.ini file ? Link to comment https://forums.phpfreaks.com/topic/70563-solved-curlphp-outputting-different-data/#findComment-354661 Share on other sites More sharing options...
clookid Posted September 25, 2007 Author Share Posted September 25, 2007 IP Secured has successfully been submitted to clooscript01. IP Secured has successfully been submitted to clooscript01. I am unsure is to why that is appearing twice. Nevertheless, it has not made the submission. Also, I do not have access to the php.ini file as this is cluster hosting that I am using. I do have a server that I could test it out on. Link to comment https://forums.phpfreaks.com/topic/70563-solved-curlphp-outputting-different-data/#findComment-354666 Share on other sites More sharing options...
d.shankar Posted September 25, 2007 Share Posted September 25, 2007 I checked your example link .. it echo's only one . Link to comment https://forums.phpfreaks.com/topic/70563-solved-curlphp-outputting-different-data/#findComment-354667 Share on other sites More sharing options...
clookid Posted September 25, 2007 Author Share Posted September 25, 2007 That's weird, it echo's twice for me. Anyway, have you any further solutions? Link to comment https://forums.phpfreaks.com/topic/70563-solved-curlphp-outputting-different-data/#findComment-354668 Share on other sites More sharing options...
d.shankar Posted September 25, 2007 Share Posted September 25, 2007 Wait i will chk your code again. Link to comment https://forums.phpfreaks.com/topic/70563-solved-curlphp-outputting-different-data/#findComment-354669 Share on other sites More sharing options...
d.shankar Posted September 25, 2007 Share Posted September 25, 2007 Instead of foreach ($servers as $server) { file_get_contents_proxy($server['szURL'], $server['szProxy'], $server['iProxyPort']); } Use this for($i=0;$i<count($servers);$i++) { file_get_contents_proxy($server['szURL'], $server['szProxy'], $server['iProxyPort']); } Link to comment https://forums.phpfreaks.com/topic/70563-solved-curlphp-outputting-different-data/#findComment-354671 Share on other sites More sharing options...
clookid Posted September 25, 2007 Author Share Posted September 25, 2007 It still hasn't worked. Link to comment https://forums.phpfreaks.com/topic/70563-solved-curlphp-outputting-different-data/#findComment-354673 Share on other sites More sharing options...
d.shankar Posted September 25, 2007 Share Posted September 25, 2007 Try this for($i=0;$i<count($servers)-1;$i++) { file_get_contents_proxy($server['szURL'], $server['szProxy'], $server['iProxyPort']); } Link to comment https://forums.phpfreaks.com/topic/70563-solved-curlphp-outputting-different-data/#findComment-354676 Share on other sites More sharing options...
clookid Posted September 25, 2007 Author Share Posted September 25, 2007 Unfortunately, I am found replying with the same answer, again. Please try fiddling around with the code on your own server, and let me know if you can manage to get the script to work. I will PM you the full script (including the password). Link to comment https://forums.phpfreaks.com/topic/70563-solved-curlphp-outputting-different-data/#findComment-354677 Share on other sites More sharing options...
d.shankar Posted September 25, 2007 Share Posted September 25, 2007 ok fine. Link to comment https://forums.phpfreaks.com/topic/70563-solved-curlphp-outputting-different-data/#findComment-354681 Share on other sites More sharing options...
clookid Posted September 25, 2007 Author Share Posted September 25, 2007 A private message has been sent. Thank you! Link to comment https://forums.phpfreaks.com/topic/70563-solved-curlphp-outputting-different-data/#findComment-354682 Share on other sites More sharing options...
d.shankar Posted September 25, 2007 Share Posted September 25, 2007 I have made some changes. <?php function file_get_contents_proxy($szURL, $szProxy, $iProxyPort) { $pCurl = curl_init($szURL); curl_setopt($pCurl, CURLOPT_PROXY, $szProxy); curl_setopt($pCurl, CURLOPT_PROXYPORT, $iProxyPort); curl_setopt($pCurl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($pCurl, CURLOPT_RETURNTRANSFER, true); curl_setopt($pCurl, CURLOPT_SSL_VERIFYPEER, false); return curl_exec($pCurl); } $password = "******"; $title = "IP Secured"; $url = "http://www.ipsecured.info"; $description = "IP%20Secured"; $note = "IP%20Secured%20--%20you%20no%20longer%20need%20to%20worry%20about%20filters."; $tags = "ip%20secured,%20proxy"; $servers =array('szURL' => 'https://clooscript01:[email protected]/v1/posts/add?url=$url&description=$description&extended=$note&tags=$tags&shared=yes', 'szProxy' => '192.17.239.250', 'iProxyPort' => '3127'); for($i=0;$i<count($servers)-1;$i++) { file_get_contents_proxy($server['szURL'], $server['szProxy'], $server['iProxyPort']); } echo "<a href='$url' alt='$title'>$title has successfully been submitted to <a href='http://del.icio.us/clooscript01'>clooscript01."; ?> Link to comment https://forums.phpfreaks.com/topic/70563-solved-curlphp-outputting-different-data/#findComment-354685 Share on other sites More sharing options...
clookid Posted September 25, 2007 Author Share Posted September 25, 2007 I understand that you have made some changes, but it is still not working. Also, please remove my password from the post. Thanks. Link to comment https://forums.phpfreaks.com/topic/70563-solved-curlphp-outputting-different-data/#findComment-354687 Share on other sites More sharing options...
d.shankar Posted September 25, 2007 Share Posted September 25, 2007 This is what i got when i ran the code IP Secured has successfully been submitted to clooscript01. Link to comment https://forums.phpfreaks.com/topic/70563-solved-curlphp-outputting-different-data/#findComment-354689 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.