Owneds Posted December 28, 2013 Share Posted December 28, 2013 Here is my code to add message on my forum. I have a problem, because I give too long text in the variable $ message is on the side instead of the ready message only appears the error: "Momentary no connection" It seems to me that my string is too long. Will you help me fix it somehow so that I could write a very long threads? $message = " [b][size=18][color=white]...................................................................[/size] [size=12]................[/size][/b][/color] [b][size=18][color=white].............[/color][/size][/b] [img=........................................................................] [b][size=18][color=white]...........................[/color][/size][/b] [code]....................................... ........................................................ ......................................................... ........................................................... ................................................... ........................................[/co de] [b][size=18][color="wh ite"]......................[/co lor][/s ize][/b] [co de].................................................. ................................................. ...............................................[/co de] [b][size=18][color="w hit e"]Zdjęcia:[/co lor][/s ize][/b] "; It's on my site shows up: Momentary lack of connection ... But if I give the example already abbreviated variable: $message = " [b][size=18][color=white]...................................[/size] [size=12]................[/size][/b][/color] [b][size=18][color=white].............[/color][/size][/b] [img=........................................................................] [b][size=18][color=white]...........................[/color][/size][/b] [c ode]....................................... ................................ .................................................... ................................................... ........................................[/co de] [b][size=18][co lor="w hite"]......................[/color][/s ize][/b] [c ode]..................................................[/c ode] ."; Now its work great... Post are sent... The Curl sending it by: &message=$message&mode=reply& Quote Link to comment https://forums.phpfreaks.com/topic/284947-curl-string-is-too-long/ Share on other sites More sharing options...
.josh Posted December 28, 2013 Share Posted December 28, 2013 1) how is that string even working for you.. you are using double quotes for the string delimiter and your value also has double quotes in it that you aren't escaping...you might want to look into using HEREDOC syntax. 2) post your actual code. Quote Link to comment https://forums.phpfreaks.com/topic/284947-curl-string-is-too-long/#findComment-1463176 Share on other sites More sharing options...
Owneds Posted December 28, 2013 Author Share Posted December 28, 2013 (edited) Thanks for answer. Ok there is my code: Html form: <form action="trypost.php" method="post"> Message: <textarea name="message" cols="1" rows="1"></textarea><br /> <input type="submit" name="submit" value="Send!!" /> </form> And my trypost.php $msg = urlencode($_POST['message']); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'http://xxxx.pl/forum/posting.php?mode=reply&t=14'); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "message=$msg&sid=$sid12&t=$t3&preview=Podgl%B1d&f=5&sid=$sid12"); curl_setopt($ch, CURLOPT_COOKIEFILE, dirname(__FILE__) . '/cookies.txt'); curl_setopt($ch, CURLOPT_COOKIEJAR, dirname(__FILE__) . '/cookies.txt'); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); $result2= curl_exec ($ch); curl_close ($ch); echo $result2; session_destroy() And now when i put into my textarea: [b][size=18][color=white]Scooby Doo Haloween 2/2 [/size] [size=12]Language: English[/size][/b][/color] [b][size=18][color=white]Leaflet:[/color][/size][/b] [img=http://Idonthavescreennow.jpg] [b][size=18][color=white]Description:[/color][/size][/b] [b][size=18][color=white]About:[/color][/size][/b] [b][size=18][color=white]Screenshots:[/color][/size][/b] [img=http://Idonthavescreennow.jpg] [code]http://www.youtube.com/watch?v=eqsLG4KvAEs[/code] All works great i can send my post... But when i try put my full code: [b][size=18][color=white]Scooby Doo Haloween 2/2 [/size] [size=12]Language: English[/size][/b][/color] [b][size=18][color=white]Leaflet:[/color][/size][/b] [img=http://Idonthavescreennow.jpg] [b][size=18][color=white]Description:[/color][/size][/b] [quote] Scooby-Doo is an American cartoon series consisting of several animated television series and related works produced from 1969 to the present day. The original series, Scooby-Doo, Where Are You!, was created for Hanna-Barbera Productions by writers Joe Ruby and Ken Spears in 1969. This Saturday morning cartoon series featured four teenagers—Fred Jones, Daphne Blake, Velma Dinkley, and Norville - Shaggy Rogers— and their talking Great Dane dog named Scooby-Doo who solve mysteries involving supposedly supernatural creatures through a series of antics and missteps [/quote] [b][size=18][color=white]About:[/color][/size][/b] [code]Language...........: English Where?.........: Youtube.com Length?.........: 11:07 Quality?.........: Max 360p From?...........: +3 years old.[/code] [b][size=18][color=white]Screenshots:[/color][/size][/b] [img=http://Idonthavescreennow.jpg] [code]http://www.youtube.com/watch?v=eqsLG4KvAEs[/code] and click: Send!!, site dont appears preview, but the error: "Momentary no connection" Text will not always be the same because this form I am trying to automatically add various fairy tales for children on my website. Please help me. :-) Edited December 28, 2013 by Owneds Quote Link to comment https://forums.phpfreaks.com/topic/284947-curl-string-is-too-long/#findComment-1463178 Share on other sites More sharing options...
Owneds Posted December 28, 2013 Author Share Posted December 28, 2013 any help? Quote Link to comment https://forums.phpfreaks.com/topic/284947-curl-string-is-too-long/#findComment-1463185 Share on other sites More sharing options...
Owneds Posted December 29, 2013 Author Share Posted December 29, 2013 !!!!!!!!!!!!!Please Delete!!!!!! Quote Link to comment https://forums.phpfreaks.com/topic/284947-curl-string-is-too-long/#findComment-1463236 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.