php


I get multiple Json Object from curel and need to conver it to PHP


After runnig the curl I get a list of json object and I need to convert it to PHP array. When I use json_decode it return a NULL value. Then I Check the json result with Json validator then it show an error in json.
Here is the CUrl Code
$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_URL => $stream_url,
CURLOPT_ENCODING => "gzip",
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTPAUTH => CURLAUTH_BASIC,
// CURLOPT_TIMEOUT => 120,
CURLOPT_USERPWD => $user . ":" . $pass,
CURLOPT_WRITEFUNCTION => "print_out_data",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_VERBOSE => true // uncomment for curl verbosity
));
$running = null;
$mh = curl_multi_init();
curl_multi_add_handle($mh, $ch);
// the event loop
$listarray= array();
do {
curl_multi_select($mh, 1); // wait for activity
curl_multi_exec($mh, $running); // perform activity
$content = curl_multi_getcontent($ch);
} while ($running > 0);
curl_multi_remove_handle($mh, $ch);
curl_multi_close($ch);
$new = json_decode($content,true)
print_r($new);
Here is ther Json result i get when i print the $content
{"id":"tag:search.twitter.com,2005:307097936616116227","objectType":"activity","actor":{"objectType":"person","id":"id:twitter.com:111054522","link":"http://www.twitter.com/Adobe_Care","displayName":"Adobe Customer Care","postedTime":"2010-02-03T17:16:58.000Z","image":"http://a0.twimg.com/profile_images/2649331561/0a1bbf035e7e66164b2514470a6a6a00_normal.png","summary":"Official Customer Support account for Adobe | \r\nTweeting M-F 1a-5p PST | Have feedback? http://bit.ly/socialfbs | Need additional help? http://forums.adobe.com","links":[{"href":null,"rel":"me"}],"friendsCount":1508,"followersCount":9235,"listedCount":353,"statusesCount":16807,"twitterTimeZone":"Eastern Time (US & Canada)","verified":true,"utcOffset":"-18000","preferredUsername":"Adobe_Care","languages":["en"]},"verb":"post","postedTime":"2013-02-28T12:00:28.000Z","generator":{"displayName":"Sprout Social","link":"http://sproutsocial.com"},"provider":{"objectType":"service","displayName":"Twitter","link":"http://www.twitter.com"},"link":"http://twitter.com/Adobe_Care/statuses/307097936616116227","body":"#maconnolly888 AdobeTV has some great tutorials - http://t.co/1BEJBLOGJG Thanks, ^Bev","object":{"objectType":"note","id":"object:search.twitter.com,2005:307097936616116227","summary":"#maconnolly888 AdobeTV has some great tutorials - http://t.co/1BEJBLOGJG Thanks, ^Bev","link":"http://twitter.com/Adobe_Care/statuses/307097936616116227","postedTime":"2013-02-28T12:00:28.000Z"},"inReplyTo":{"link":"http://twitter.com/maconnolly888/statuses/306915834578751488"},"twitter_entities":{"hashtags":[],"urls":[{"url":"http://t.co/1BEJBLOGJG","expanded_url":"http://adobe.ly/YIz8Eg","display_url":"adobe.ly/YIz8Eg","indices":[50,72]}],"user_mentions":[{"screen_name":"maconnolly888","name":"martin connolly","id":17490272,"id_str":"17490272","indices":[0,14]}]},"retweetCount":0,"gnip":{"matching_rules":[{"value":"from:111054522","tag":null}],"urls":[{"url":"http://t.co/1BEJBLOGJG","expanded_url":"http://tv.adobe.com/show/learn-creative-cloud/"}],"klout_score":60,"language":{"value":"en"}}} {"id":"tag:search.twitter.com,2005:307098755235184640","objectType":"activity","actor":{"objectType":"person","id":"id:twitter.com:74614502","link":"http://www.twitter.com/TheNextWebAsia","displayName":"TheNextWeb Asia","postedTime":"2009-09-16T01:13:07.000Z","image":"http://a0.twimg.com/profile_images/1108109662/tnwasia_twitter_normal.png","summary":"Part of #thenextweb family here you will find the latest tech news from Asia. Updates from #jonrussell and #beijingdou","links":[{"href":"http://thenextweb.com/asia","rel":"me"}],"friendsCount":1123,"followersCount":4734,"listedCount":327,"statusesCount":2520,"twitterTimeZone":"Bangkok","verified":false,"utcOffset":"25200","preferredUsername":"TheNextWebAsia","languages":["en"],"location":{"objectType":"place","displayName":"Asia"}},"verb":"post","postedTime":"2013-02-28T12:03:43.000Z","generator":{"displayName":"TwitPublisher","link":"http://wordpress.org/extend/plugins/twitter-publisher/"},"provider":{"objectType":"service","displayName":"Twitter","link":"http://www.twitter.com"},"link":"http://twitter.com/TheNextWebAsia/statuses/307098755235184640","body":"Tencent focuses on Indonesia with local joint venture to promote its WeChat mobile app http://t.co/UggpJQHzPa by #jonrussell","object":{"objectType":"note","id":"object:search.twitter.com,2005:307098755235184640","summary":"Tencent focuses on Indonesia with local joint venture to promote its WeChat mobile app http://t.co/UggpJQHzPa by #jonrussell","link":"http://twitter.com/TheNextWebAsia/statuses/307098755235184640","postedTime":"2013-02-28T12:03:43.000Z"},"twitter_entities":{"hashtags":[],"urls":[{"url":"http://t.co/UggpJQHzPa","expanded_url":"http://tnw.to/r1kJ","display_url":"tnw.to/r1kJ","indices":[87,109]}],"user_mentions":[{"screen_name":"jonrussell","name":"Jon Russell","id":6132422,"id_str":"6132422","indices":[113,124]}]},"retweetCount":0,"gnip":{"matching_rules":[{"value":"from:74614502","tag":null}],"urls":[{"url":"http://t.co/UggpJQHzPa","expanded_url":"http://thenextweb.com/asia/2013/02/28/tencent-focuses-on-indonesia-with-local-joint-venture-to-promote-its-wechat-mobile-app/?utm_source=Twitter&utm_content=Tencent+focuses+on+Indonesia+with+local+joint+venture+to+promote+its+WeChat+mobile+app&utm_campaign=social+media&awesm=tnw.to_r1kJ&utm_medium=Twitter+Publisher"}],"klout_score":57,"language":{"value":"en"}}} {"id":"tag:search.twitter.com,2005:307099167946313728","objectType":"activity","actor":{"objectType":"person","id":"id:twitter.com:31175695","link":"http://www.twitter.com/ProntoForms","displayName":"ProntoForms","postedTime":"2009-04-14T17:36:42.000Z","image":"http://a0.twimg.com/profile_images/1606516105/ProntoAppIcon-200x200_normal.png","summary":"ProntoForms is a simple to use mobile forms app for iPhones, Blackberry, Android, and Windows Mobile devices. Try it today!","links":[{"href":"http://www.prontoforms.com","rel":"me"}],"friendsCount":459,"followersCount":369,"listedCount":3,"statusesCount":1576,"twitterTimeZone":"Eastern Time (US & Canada)","verified":false,"utcOffset":"-18000","preferredUsername":"ProntoForms","languages":["en"],"location":{"objectType":"place","displayName":"Ottawa, Canada"}},"verb":"post","postedTime":"2013-02-28T12:05:21.000Z","generator":{"displayName":"HootSuite","link":"http://www.hootsuite.com"},"provider":{"objectType":"service","displayName":"Twitter","link":"http://www.twitter.com"},"link":"http://twitter.com/ProntoForms/statuses/307099167946313728","body":"Thanks for following #jennzmitchell","object":{"objectType":"note","id":"object:search.twitter.com,2005:307099167946313728","summary":"Thanks for following #jennzmitchell","link":"http://twitter.com/ProntoForms/statuses/307099167946313728","postedTime":"2013-02-28T12:05:21.000Z"},"twitter_entities":{"hashtags":[],"urls":[],"user_mentions":[{"screen_name":"jennzmitchell","name":"Jennifer Mitchell","id":210779450,"id_str":"210779450","indices":[21,35]}]},"retweetCount":0,"gnip":{"matching_rules":[{"value":"from:31175695","tag":null}],"klout_score":40,"language":{"value":"en"}}}

Related Links

How to read /r/n like a newline from database
My regular expression isn't capturing the groups correctly
Which is faster array_merge or array_splice to merge arrays?
php multidimensional array combinations for an ecommerce [duplicate]
Phpunit not running Symfony tests
Merge two sets of array keys in order
PHP global scope and variable initialization
PHP or SQL for Large Data and Sub/Related Data Sets
Wordpress Redux Framework “redux/options/{opt_name}/settings/change” hook
Laravel 5.4 Multi auth - Auth::guard()->user() empty
Paypal 500 Error: javax.validation.ValidationException
Warning: Illegal string offset 'OperationRequest' in: Error in josn / PHP
Dynamic hasMany relationship in Laravel/Eloquent
Video file moves to folder but does not upload to database
While-function for mysqli_fetch_assoc is infinite
Video file is not uploading to the server using codeigniter

Categories

HOME
clearcase
couchdb
operating-system
nsview
initialization
openlayers-3
swift2
ontology
visualforce
cdi
u-boot
cocotb
gtk
watch-os-3
circleci
smooks
fullcalendar-scheduler
amazon-elb
jpa-2.0
squid
max-msp-jitter
dma
pinterest
android-5.1.1-lollipop
pickle
scheduled-tasks
altium-designer
connection-refused
mod-wsgi
password-generator
introspection
webviewclient
ruby-daemons
history.js
lxml
mongoengine
nest
grails-2.5
stackpanel
spring-restcontroller
task-parallel-library
export-to-pdf
vesta
daz3d
viewmodel
roracle
android-webservice
.when
dynamics-crm-4
dymola
cognos-tm1
petsc
boost-compute
jpda
carmen
seccomp
android-4.2-jelly-bean
right-to-left
meld
strpos
facebook-ios-sdk
mnesia
gridbaglayout
preferenceactivity
openmrs
management-studio-express
vim-plugin
diawi
largenumber
mixins
libz
google-gdk
org-babel
web-api
clarion
text-align
baseadapter
cakephp-2.2
communicate
reference-counting
air-native-extension
lync-2010
proxy-server
pbkdf2
apache-shindig
mute
insertonsubmit
stty
multiscaleimage
cgrectmake
gitx
live-wallpaper
dropshadow
datacontracts
page-curl
jquery-1.4
printqueue
eventaggregator
suggestbox

Resources

Encrypt Message