Skip to content
This repository was archived by the owner on Dec 4, 2018. It is now read-only.

Conversation

@rshamyan
Copy link

PSR-4 able to include this library with modern php frameworks, like Yii2,Laravel, ...

@jmathai
Copy link
Owner

jmathai commented Jul 29, 2015

Any chance you'd like to create psr-4 support in jmathai/php-multi-curl which should replace EpiCurl and make that a dependency? :)

I'll verify and merge later today.

@rshamyan
Copy link
Author

Done. But test failed. EpiCurl->addEasyCurl doesn't exist at library

$ php simpleTest.php

<h1>Single test to verify everything works ok</h1>

<h2><a href="javascript:void(0);" onclick="viewSource();">View the source of this file</a></h2>
<div id="source" style="display:none; padding:5px; border: dotted 1px #bbb; background-color:#ddd;">
<code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #007700">include&nbsp;</span><span style="color: #DD0000">'./EpiOAuth.php'</span><span style="color: #007700">;<br />include&nbsp;</span><span style="color: #DD0000">'./EpiTwitter.php'</span><span style="color: #007700">;<br />include&nbsp;</span><span style="color: #DD0000">'./vendor/jmathai/php-multi-curl/EpiCurl.php'</span><span style="color: #007700">;<br />use&nbsp;</span><span style="color: #0000BB">jmathai</span><span style="color: #007700">\</span><span style="color: #0000BB">php_multi_curl</span><span style="color: #007700">\</span><span style="color: #0000BB">EpiCurl</span><span style="color: #007700">;<br />use&nbsp;</span><span style="color: #0000BB">jmathai</span><span style="color: #007700">\</span><span style="color: #0000BB">twitter_async</span><span style="color: #007700">\</span><span style="color: #0000BB">EpiOAuth</span><span style="color: #007700">;<br />use&nbsp;</span><span style="color: #0000BB">jmathai</span><span style="color: #007700">\</span><span style="color: #0000BB">twitter_async</span><span style="color: #007700">\</span><span style="color: #0000BB">EpiTwitter</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">$consumer_key&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'jdv3dsDhsYuJRlZFSuI2fg'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$consumer_secret&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'NNXamBsBFG8PnEmacYs0uCtbtsz346OJSod7Dl94'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$token&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'25451974-uakRmTZxrSFQbkDjZnTAsxDO5o9kacz2LT6kqEHA'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$secret</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'CuQPQ1WqIdSJDTIkDUlXjHpbcRao9lcKhQHflqGE8'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$twitterObj&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">EpiTwitter</span><span style="color: #007700">(</span><span style="color: #0000BB">$consumer_key</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$consumer_secret</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$token</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$secret</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$twitterObjUnAuth&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">EpiTwitter</span><span style="color: #007700">(</span><span style="color: #0000BB">$consumer_key</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$consumer_secret</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;<br /></span><br />&lt;h1&gt;Single&nbsp;test&nbsp;to&nbsp;verify&nbsp;everything&nbsp;works&nbsp;ok&lt;/h1&gt;<br /><br />&lt;h2&gt;&lt;a&nbsp;href="javascript:void(0);"&nbsp;onclick="viewSource();"&gt;View&nbsp;the&nbsp;source&nbsp;of&nbsp;this&nbsp;file&lt;/a&gt;&lt;/h2&gt;<br />&lt;div&nbsp;id="source"&nbsp;style="display:none;&nbsp;padding:5px;&nbsp;border:&nbsp;dotted&nbsp;1px&nbsp;#bbb;&nbsp;background-color:#ddd;"&gt;<br /><span style="color: #0000BB">&lt;?php&nbsp;highlight_file</span><span style="color: #007700">(</span><span style="color: #0000BB">__FILE__</span><span style="color: #007700">);&nbsp;</span><span style="color: #0000BB">?&gt;<br /></span>&lt;/div&gt;<br /><br />&lt;hr&gt;<br /><br />&lt;h2&gt;Generate&nbsp;the&nbsp;authorization&nbsp;link&lt;/h2&gt;<br /><span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #007700">echo&nbsp;</span><span style="color: #0000BB">$twitterObjUnAuth</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getAuthenticateUrl</span><span style="color: #007700">();&nbsp;</span><span style="color: #0000BB">?&gt;<br /></span><br />&lt;hr&gt;<br /><br />&lt;h2&gt;Verify&nbsp;credentials&lt;/h2&gt;<br /><span style="color: #0000BB">&lt;?php<br />&nbsp;&nbsp;$creds&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$twitterObj</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">get</span><span style="color: #007700">(</span><span style="color: #DD0000">'/account/verify_credentials.json'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;<br /></span>&lt;pre&gt;<br /><span style="color: #0000BB">&lt;?php&nbsp;print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$creds</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">response</span><span style="color: #007700">);&nbsp;</span><span style="color: #0000BB">?&gt;<br /></span>&lt;/pre&gt;<br /><br />&lt;hr&gt;<br /><br />&lt;h2&gt;Post&nbsp;status&lt;/h2&gt;<br /><span style="color: #0000BB">&lt;?php<br />&nbsp;&nbsp;$status&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$twitterObj</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">post</span><span style="color: #007700">(</span><span style="color: #DD0000">'/statuses/update.json'</span><span style="color: #007700">,&nbsp;array(</span><span style="color: #DD0000">'status'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'This&nbsp;a&nbsp;simple&nbsp;test&nbsp;from&nbsp;twitter-async&nbsp;at&nbsp;'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">date</span><span style="color: #007700">(</span><span style="color: #DD0000">'m-d-Y&nbsp;h:i:s'</span><span style="color: #007700">)));<br /></span><span style="color: #0000BB">?&gt;<br /></span>&lt;pre&gt;<br /><span style="color: #0000BB">&lt;?php&nbsp;print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$status</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">response</span><span style="color: #007700">);&nbsp;</span><span style="color: #0000BB">?&gt;<br /></span>&lt;/pre&gt;<br /><br />&lt;script&gt;&nbsp;function&nbsp;viewSource()&nbsp;{&nbsp;document.getElementById('source').style.display=document.getElementById('source').style.display=='block'?'none':'block';&nbsp;}&nbsp;&lt;/script&gt;<br /></span>
</code></div>

<hr>

<h2>Generate the authorization link</h2>

Fatal error: Call to undefined method jmathai\php_multi_curl\EpiCurl::addEasyCurl() in C:\Users\rshamyan\Documents\development\twitter-async\EpiOAuth.php on line 237

Call Stack:
    0.0003     131152   1. {main}() C:\Users\rshamyan\Documents\development\twitter-async\simpleTest.php:0
    0.0065     394328   2. jmathai\twitter_async\EpiOAuth->getAuthenticateUrl() C:\Users\rshamyan\Documents\development\twitter-async\simpleTest.php:28
    0.0065     394448   3. jmathai\twitter_async\EpiOAuth->getRequestToken() C:\Users\rshamyan\Documents\development\twitter-async\EpiOAuth.php:51
    0.0065     394568   4. jmathai\twitter_async\EpiOAuth->httpRequest() C:\Users\rshamyan\Documents\development\twitter-async\EpiOAuth.php:76
    0.0068     396272   5. jmathai\twitter_async\EpiOAuth->httpPost() C:\Users\rshamyan\Documents\development\twitter-async\EpiOAuth.php:102
    0.0070     398112   6. jmathai\twitter_async\EpiOAuth->executeCurl() C:\Users\rshamyan\Documents\development\twitter-async\EpiOAuth.php:280

@jmathai
Copy link
Owner

jmathai commented Jul 30, 2015

@ntstv let me update.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants